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-12689] Undiagnosed argument mismatch involving pointer types #55133

Closed
LucianoPAlmeida opened this issue Apr 28, 2020 · 2 comments
Closed
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

@LucianoPAlmeida
Copy link
Collaborator

Previous ID SR-12689
Radar rdar://problem/62481592
Original Reporter @LucianoPAlmeida
Type Bug
Status Closed
Resolution Done
Environment

GitHub master, 013387e

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

md5: 7f41b7e664097a5b9aac7ea8e9ef1c6e

Issue Description:

That's from this forum discussion https://forums.swift.org/t/error-type-of-expression-is-ambiguous-without-more-context/35816
I just minimize the sample code to reproduce it

func a(_ u: UnsafeBufferPointer<UInt16>) {}

let array : [UInt16] = [1, 2]

array.withUnsafeBufferPointer {
  a(UnsafeRawPointer($0).bindMemory(to: UInt16.self, capacity: 1)) // type of expression is ambiguous without more context

// Also

UnsafeRawPointer($0) as UnsafePointer<UInt16> // type of expression is ambiguous without more context
}

Simple examples to reproduce

func foo(_ u: Int) -> String { "" }
func foo(_ u: String) -> Double { 0 }

func bar(_ u: Int) {}

bar(foo(1 as Double))  // type of expression is ambiguous without more context

foo(1 as Double) as Int  // type of expression is ambiguous without more context
@beccadax
Copy link
Contributor

@swift-ci create

@LucianoPAlmeida
Copy link
Collaborator Author

Fixed by #31713

Thanks @xedin 🙂

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal added diagnostics QoI Bug: Diagnostics Quality of Implementation and removed DiagnosticsQol labels Apr 26, 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

3 participants