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-5388] Another useless diagnostic: "type of expression is ambiguous without more context" #47962

Closed
NachoSoto opened this issue Jul 6, 2017 · 4 comments
Assignees
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

@NachoSoto
Copy link
Contributor

Previous ID SR-5388
Radar rdar://problem/33914447
Original Reporter @NachoSoto
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42)
Swift version 4.0 (swiftlang-900.0.43 clang-900.0.22.8)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee @NachoSoto
Priority Medium

md5: 8d52a4972173defbbb0aeb6a0a9e3d82

Issue Description:

extension Sequence where Iterator.Element == (key: String, value: String) {
    func f() -> Array<Int> {
        return []
    }
}

func a(_ b: Array<Int>) {}

func b() {
    a([ "a" : 2 ].f())
}
error: repl.swift:4:19: error: type of expression is ambiguous without more context
    a([ "a" : 2 ].f())
      ~~~~~~~~~~~~^
@belkadan
Copy link
Contributor

belkadan commented Jul 6, 2017

cc @xedin

@slavapestov
Copy link
Member

@swift-ci create

@swift-ci
Copy link
Collaborator

Comment by Steffan Andrews (JIRA)

Another repro:

extension Array where Element == String {
    public var test: [String] {
        return ["test"]
    }
}

[123].test
error: MyPlayground.playground:3:7: error: type of expression is ambiguous without more context
[123].test
~~~~~~^~~~

@xedin
Copy link
Member

xedin commented May 24, 2019

Fixed by #24791

Produces - `error: cannot convert value of type 'Int' to expected dictionary value type 'String'`

Please use the next nightly snapshot of 5.1 or master to validate.

@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

5 participants