@@ -10,6 +10,10 @@ protocol P {
10
10
var x : Int { get }
11
11
}
12
12
13
+ struct Box < T> {
14
+ let t : T
15
+ }
16
+
13
17
func s010_hasVarArg( _ args: Any ... ) { }
14
18
15
19
// Test that we still use addresses when dealing with array initialization
@@ -392,9 +396,24 @@ func s240_____propOfLValue(_ x: Error) -> String {
392
396
return x. _domain
393
397
}
394
398
399
+ // Tests Implicit Value Construction under Opaque value mode
400
+ // ---
401
+ // CHECK-LABEL: sil hidden @_T020opaque_values_silgen21s250_________testBoxTyyF : $@convention(thin) () -> () {
402
+ // CHECK: bb0:
403
+ // CHECK: [[BOX_MTYPE:%.*]] = metatype $@thin Box<Int>.Type
404
+ // CHECK: [[MTYPE:%.*]] = metatype $@thin Int.Type
405
+ // CHECK: [[INTLIT:%.*]] = integer_literal $Builtin.Int2048, 42
406
+ // CHECK: [[AINT:%.*]] = apply {{.*}}([[INTLIT]], [[MTYPE]]) : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int
407
+ // CHECK: apply {{.*}}<Int>([[AINT]], [[BOX_MTYPE]]) : $@convention(method) <τ_0_0> (@in τ_0_0, @thin Box<τ_0_0>.Type) -> @out Box<τ_0_0>
408
+ // CHECK: return %{{.*}} : $()
409
+ // CHECK-LABEL: } // end sil function '_T020opaque_values_silgen21s250_________testBoxTyyF'
410
+ func s250_________testBoxT( ) {
411
+ let _ = Box ( t: 42 )
412
+ }
413
+
395
414
// Tests conditional value casts and correspondingly generated reabstraction thunk, with <T> types
396
415
// ---
397
- // CHECK-LABEL: sil hidden @_T020opaque_values_silgen21s250_____condTFromAnyyyp_xtlF : $@convention(thin) <T> (@in Any, @in T) -> () {
416
+ // CHECK-LABEL: sil hidden @_T020opaque_values_silgen21s999_____condTFromAnyyyp_xtlF : $@convention(thin) <T> (@in Any, @in T) -> () {
398
417
// CHECK: bb0([[ARG0:%.*]] : $Any, [[ARG1:%.*]] : $T):
399
418
// CHECK: [[BORROWED_ARG:%.*]] = begin_borrow [[ARG0]]
400
419
// CHECK: [[COPY__ARG:%.*]] = copy_value [[BORROWED_ARG]]
@@ -404,12 +423,21 @@ func s240_____propOfLValue(_ x: Error) -> String {
404
423
// CHECK: partial_apply [[THUNK_REF]]<T>([[THUNK_PARAM]])
405
424
// CHECK: bb6:
406
425
// CHECK: return %{{.*}} : $()
407
- // CHECK-LABEL: } // end sil function '_T020opaque_values_silgen21s250_____condTFromAnyyyp_xtlF '
408
- func s250_____condTFromAny < T> ( _ x: Any , _ y: T ) {
426
+ // CHECK-LABEL: } // end sil function '_T020opaque_values_silgen21s999_____condTFromAnyyyp_xtlF '
427
+ func s999_____condTFromAny < T> ( _ x: Any , _ y: T ) {
409
428
if let f = x as? ( Int , T ) -> ( Int , T ) {
410
429
f ( 42 , y)
411
430
}
412
431
}
432
+
433
+ // s250_________testBoxT continued Tests Implicit Value Construction under Opaque value mode
434
+ // ---
435
+ // CHECK-LABEL: sil hidden @_T020opaque_values_silgen3BoxVACyxGx1t_tcfC : $@convention(method) <T> (@in T, @thin Box<T>.Type) -> @out Box<T> {
436
+ // CHECK: bb0([[ARG0:%.*]] : $T, [[ARG1:%.*]] : $@thin Box<T>.Type):
437
+ // CHECK: [[RETVAL:%.*]] = struct $Box<T> ([[ARG0]] : $T)
438
+ // CHECK: return [[RETVAL]] : $Box<T>
439
+ // CHECK-LABEL: } // end sil function '_T020opaque_values_silgen3BoxVACyxGx1t_tcfC'
440
+
413
441
// CHECK-LABEL: sil shared [transparent] [reabstraction_thunk] @{{.*}} : $@convention(thin) (Int, Int, Int, Int, Int, @owned @callee_owned (@in (Int, (Int, (Int, Int)), Int)) -> @out (Int, (Int, (Int, Int)), Int)) -> (Int, Int, Int, Int, Int)
414
442
// CHECK: bb0([[ARG0:%.*]] : $Int, [[ARG1:%.*]] : $Int, [[ARG2:%.*]] : $Int, [[ARG3:%.*]] : $Int, [[ARG4:%.*]] : $Int, [[ARG5:%.*]] : $@callee_owned (@in (Int, (Int, (Int, Int)), Int)) -> @out (Int, (Int, (Int, Int)), Int)):
415
443
// CHECK: [[TUPLE_TO_APPLY0:%.*]] = tuple ([[ARG2]] : $Int, [[ARG3]] : $Int)
0 commit comments