-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
| 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 contextMetadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis