Skip to content

Commit 99ea407

Browse files
committed
Use explicit conversions form 'T' to 'Optional<T>'
This commit work arounds a current defect of the emitter causing the lowering of assignments to ignore necessary coercions for storing the member of a union into a union container.
1 parent d4d69cb commit 99ea407

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//- compileAndRun expecting: success
22

33
public fun main() {
4-
var x: Optional<Int> = 42
4+
var x = 42 as Optional<Int>
55
let y = if let i: Int = x { i.copy() } else { 0 }
66
precondition(y == 42)
77

8-
&x = None()
8+
&x = None() as Optional<Int>
99
let z = if let i: Int = x { i.copy() } else { 0 }
1010
precondition(z == 0)
1111
}

0 commit comments

Comments
 (0)