File tree 4 files changed +47
-8
lines changed
4 files changed +47
-8
lines changed Original file line number Diff line number Diff line change @@ -3385,11 +3385,12 @@ bool BuiltinType::isBitwiseCopyable() const {
3385
3385
return false ;
3386
3386
3387
3387
case BuiltinTypeKind::BuiltinFixedArray: {
3388
- // Bitwise-copyability depends on the element type.
3388
+ // FixedArray<N, X> : BitwiseCopyable whenever X : BitwiseCopyable
3389
3389
auto bfa = cast<BuiltinFixedArrayType>(this );
3390
3390
auto &C = bfa->getASTContext ();
3391
- return (bool )lookupConformance (bfa->getElementType (),
3392
- C.getProtocol (KnownProtocolKind::BitwiseCopyable));
3391
+ return (bool )checkConformance (
3392
+ bfa->getElementType (),
3393
+ C.getProtocol (KnownProtocolKind::BitwiseCopyable));
3393
3394
}
3394
3395
}
3395
3396
}
Original file line number Diff line number Diff line change @@ -3000,6 +3000,7 @@ bool TypeConverter::visitAggregateLeaves(
3000
3000
return isa<SILPackType>(ty) ||
3001
3001
isa<TupleType>(ty) ||
3002
3002
isa<PackExpansionType>(ty) ||
3003
+ isa<BuiltinFixedArrayType>(ty) ||
3003
3004
ty.getEnumOrBoundGenericEnum () ||
3004
3005
ty.getStructOrBoundGenericStruct ();
3005
3006
};
@@ -3036,6 +3037,13 @@ bool TypeConverter::visitAggregateLeaves(
3036
3037
insertIntoWorklist (expansion.getPatternType (),
3037
3038
origTy.getPackExpansionPatternType (),
3038
3039
field, index );
3040
+ } else if (auto array = dyn_cast<BuiltinFixedArrayType>(ty)) {
3041
+ auto origBFA = origTy.getAs <BuiltinFixedArrayType>();
3042
+ insertIntoWorklist (
3043
+ array->getElementType (),
3044
+ AbstractionPattern (origTy.getGenericSignatureOrNull (),
3045
+ origBFA->getElementType ()),
3046
+ field, index );
3039
3047
} else if (auto *decl = ty.getStructOrBoundGenericStruct ()) {
3040
3048
for (auto *structField : decl->getStoredProperties ()) {
3041
3049
auto subMap = ty->getContextSubstitutionMap ();
Original file line number Diff line number Diff line change 1
- // RUN: %target-swift-frontend \
2
- // RUN: %s \
3
- // RUN: -emit-silgen \
4
- // RUN: -target %target-swift-5.1-abi-triple \
5
- // RUN: -enable-experimental-feature Sensitive \
1
+ // RUN: %target-swift-frontend \
2
+ // RUN: %s \
3
+ // RUN: -emit-silgen \
4
+ // RUN: -disable-experimental-parser-round-trip \
5
+ // RUN: -target %target-swift-5.1-abi-triple \
6
+ // RUN: -enable-experimental-feature Sensitive \
7
+ // RUN: -enable-experimental-feature ValueGenerics \
6
8
// RUN: -enable-builtin-module
7
9
10
+ // FIXME: Remove -disable-experimental-parser-round-trip when it's not required for using ValueGenerics.
11
+
8
12
// REQUIRES: swift_feature_Sensitive
13
+ // REQUIRES: swift_feature_ValueGenerics
14
+
15
+ // REQUIRES: asserts
9
16
10
17
// Force verification of TypeLowering's isTrivial.
11
18
@@ -68,3 +75,10 @@ struct S_Explicit_Sensitive {
68
75
69
76
func takeS_Explicit_Sensitive( _ s: S_Explicit_Sensitive ) {
70
77
}
78
+
79
+ import Builtin
80
+
81
+ func foo( ) {
82
+ let bricks : Builtin . FixedArray < 1 , Conditional < Int > >
83
+ let bricks2 : Builtin . FixedArray < 1 , Conditional < String > >
84
+ }
Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift \
2
+ // RUN: -disable-experimental-parser-round-trip \
2
3
// RUN: -disable-availability-checking \
3
4
// RUN: -enable-experimental-feature NonescapableTypes \
5
+ // RUN: -enable-experimental-feature ValueGenerics \
4
6
// RUN: -enable-experimental-feature Sensitive \
5
7
// RUN: -enable-builtin-module \
6
8
// RUN: -debug-diagnostic-names
7
9
10
+ // FIXME: Remove -disable-experimental-parser-round-trip when it's not required for using ValueGenerics.
11
+
8
12
// REQUIRES: swift_feature_NonescapableTypes
13
+ // REQUIRES: swift_feature_ValueGenerics
9
14
// REQUIRES: swift_feature_Sensitive
10
15
11
16
//==============================================================================
@@ -109,6 +114,17 @@ func passS_Implicit_Sensitive(_ s: S_Implicit_Sensitive) {
109
114
// expected-note@-94 {{where_requirement_failure_one_subst}}
110
115
}
111
116
117
+ import Builtin
118
+
119
+ func passFixedArray1N< T> ( _ fa: Builtin . FixedArray < 1 , T> ) {
120
+ take1 ( fa) // expected-error {{type_does_not_conform_decl_owner}}
121
+ // expected-note@-101 {{where_requirement_failure_one_subst}}
122
+ }
123
+
124
+ func passFixedArray1N< T : BitwiseCopyable > ( _ fa: Builtin . FixedArray < 1 , T> ) {
125
+ take1 ( fa)
126
+ }
127
+
112
128
//==============================================================================
113
129
//===========================DEPENDENCY-FREE TESTS=(END)======================}}
114
130
//==============================================================================
You can’t perform that action at this time.
0 commit comments