Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13545] Type of expression is ambiguous without more context #55982

Closed
swift-ci opened this issue Sep 12, 2020 · 5 comments
Closed

[SR-13545] Type of expression is ambiguous without more context #55982

swift-ci opened this issue Sep 12, 2020 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13545
Radar rdar://problem/68927132
Original Reporter rmann (JIRA User)
Type Bug
Status Resolved
Resolution Won't Do

Attachment: Download

Environment

Xcode 12b6

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee rmann (JIRA)
Priority Medium

md5: 500b8af3bf7d2d412b0489eee0016205

Issue Description:

See attached screenshot. This error message is vague and unhelpful. The real problem is that there's no matching init method on ToolComponentPropertyContent.

@theblixguy
Copy link
Collaborator

Would it be possible to provide a self-contained reproducer? Thanks!

@swift-ci
Copy link
Collaborator Author

Comment by Rick M (JIRA)

I tried but it behaves correctly in a Playground:

struct
Foo
{
    var     id: UUID?
    var     s: String?
    var     bars: [Bar]?
}

struct
FooContent
{
    var bars: [BarContent]?
    
    init(from: Foo)
    {
        self.bars = from.bars.map { BarContent(from: $0) }
    }
}

struct
Bar
{
}

struct
BarContent
{
    var     id: UUID?
    var     s: String?
    
    init(id: UUID?, s: String?)
    {
        self.id = id
        self.s = s
    }
}

error: EventSim.playground:156:48: error: extra argument 'from' in call
                self.bars = from.bars.map { BarContent(from: $0) }
                                                             ^~

error: EventSim.playground:156:41: error: missing arguments for parameters 'id', 's' in call
                self.bars = from.bars.map { BarContent(from: $0) }
                                                      ^

EventSim.playground:171:2: note: 'init(id:s:)' declared here
        init(id: UUID?, s: String?)
        ^

@typesanitizer
Copy link

@swift-ci create

@xedin
Copy link
Member

xedin commented Sep 18, 2020

rmann (JIRA User) Could you please test with the trunk development snapshot from https://swift.org/download/#snapshots in Xcode?

@xedin
Copy link
Member

xedin commented Mar 29, 2021

It's been a while since this has been opened. I'm not sure we can do much unless there is an example we could use to reproduce the problem. rmann (JIRA User) please use the latest snapshot of main branch to check whether this problem is already fixed.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants