-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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 itselftype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Previous ID | SR-13135 |
Radar | rdar://problem/65088975 |
Original Reporter | DeeSee (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Done |
Environment
Xcode 12 Beta 1/macOS Catalina 10.15.5 (19F101)
Additional Detail from JIRA
Votes | 4 |
Component/s | Compiler |
Labels | Bug, TypeChecker |
Assignee | DeeSee (JIRA) |
Priority | Medium |
md5: de79c846cf09afec4f64b77b416ac261
Issue Description:
Consider this code sample:
private struct Foo {
var bar: [Int] = []
}
let baz: Int? = nil
func foo<T: Equatable>(
_ a: @autoclosure () throws -> T,
_ b: @autoclosure () throws -> T
) {}
foo(Foo().bar, [baz])
It runs perfectly fine in Xcode 11.5 playground, while Xcode 12 Beta 1 outputs the following error:
error: test.playground:11:17: error: cannot convert value of type 'Int?' to expected element type 'Array<Int>.ArrayLiteralElement' (aka 'Int')
foo(Foo().bar, [baz])
Please note that @autoclosure attribute for foo's parameters is a required precondition for this issue.
Metadata
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 itselftype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis