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-168] Compiler incorrectly resolves type inference error as "ambiguous reference to member ..." #42790

Closed
swift-ci opened this issue Dec 10, 2015 · 2 comments · Fixed by #59535
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-168
Radar None
Original Reporter nikita (JIRA User)
Type Bug
Environment

Xcode 7.2 (7C68)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee None
Priority Medium

md5: eb1b8c6f0b081ea09744c1503d1588d0

Issue Description:

In case function that takes closure require type inference resolution and it is called in a context where type can not be inferred compiler reports a wrong error. For example:

func a<T>(b: ()->()) -> T.Type {
    return T.self
}

let c = a {
    print("")
}

This code reports following error:

error: ambiguous reference to member 'print'

commenting out print cause a proper error:

error: generic parameter 'T' could not be inferred
@gottesmm
Copy link
Contributor

Sending to Chris Willmore to screen. (Looks like a type inference issue?).

@Dante-Broggi
Copy link
Contributor

This still occurs in the Xcode 9.4.1 toolchain.

In addition it looks to be relating to the "single expression closures have an implicit return" rule.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
AnthonyLatsis added a commit to AnthonyLatsis/swift that referenced this issue Jun 17, 2022
AnthonyLatsis added a commit to AnthonyLatsis/swift that referenced this issue Jun 22, 2022
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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants