skiptools / skiptools/skip-ui

Bad error message using deprecated overlay syntax

Open
#186 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
330
Forks
76
Avg merge
3h 6m
Merged PRs (30d)
1

Description

In https://github.com/dfabulich/skipapp-showcase/commit/43ba20131eabf76fa3982ddf1352603d378829e8 I pushed a commit to repro this bug.

This commit uses SwiftUI's deprecated overlay(_:alignment:) modifier. The alignment: parameter defaults to .center, so it looks like this:

.overlay(
    Circle()
        .fill(.red.opacity(0.5))
        .frame(width: 100, height: 100)
)

They now recommend using overlay(alignment:content:) instead, like this:

.overlay {
    Circle()
        .fill(.red.opacity(0.5))
        .frame(width: 100, height: 100)
}

But plenty of online examples (and therefore LLMs) include code using the old syntax. Unfortunately, the old syntax fails with a very confusing error message.

The error message I get in https://github.com/dfabulich/skipapp-showcase/commit/43ba20131eabf76fa3982ddf1352603d378829e8 is:

Skip is unable to determine the owning type for member 'blue'. This often occurs when other issues prevent Skip from matching the surrounding API call, and it may resolve when those issues are fixed. Or add the owning type explicitly (e.g. MyType.blue)

If I remove the .border(.blue) line completely, I get a somewhat more useful error message:

/Users/dfabulich/git/skipapp-showcase/Sources/Showcase/OverlayPlayground.swift:53:29 Argument type mismatch: actual type is 'skip.ui.View', but 'skip.ui.ShapeStyle' was expected.

The issue here is that SkipUI doesn't even mention overlay(_:alignment:), so Skip assumes I'm calling overlay(_:ignoresSafeAreaEdges:), whose first argument is a ShapeStyle (and the second argument defaults to .all).

It's easy to workaround by switching from parentheses to curly brackets, but figuring that out took me a long, long time.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction commit and the failing call in Sources/Showcase/OverlayPlayground.swift, then trace how SkipUI resolves overlay overloads and reports the mismatch. The fix is complete when deprecated overlay(_:alignment:) usage produces an accurate, actionable diagnostic instead of the misleading ShapeStyle or owning-type errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.