Skip to content

Commit 4a7fb6f

Browse files
committed
Some test fixes
1 parent bd18bb3 commit 4a7fb6f

File tree

7 files changed

+43
-23
lines changed

7 files changed

+43
-23
lines changed

lib/Demangling/NodePrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ class NodePrinter {
10921092
auto isGenericParamValue = [&](unsigned depth, unsigned index) {
10931093
for (unsigned i = numGenericParams; i < firstRequirement; ++i) {
10941094
auto child = Node->getChild(i);
1095-
if (child->getKind() != Node::Kind::DependentGenericParamPackMarker)
1095+
if (child->getKind() != Node::Kind::DependentGenericParamValueMarker)
10961096
continue;
10971097
child = child->getChild(0);
10981098

lib/IRGen/GenMeta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3318,7 +3318,7 @@ static void emitInitializeRawLayout(IRGenFunction &IGF, SILType likeType,
33183318
auto rawLayout = T.getRawLayout();
33193319
auto likeTypeLayout = emitTypeLayoutRef(IGF, likeType, collector);
33203320
auto structLayoutflags = StructLayoutFlags::Swift5Algorithm;
3321-
RawLayoutFlags rawLayoutFlags;
3321+
auto rawLayoutFlags = (RawLayoutFlags) 0;
33223322

33233323
if (rawLayout->shouldMoveAsLikeType())
33243324
rawLayoutFlags |= RawLayoutFlags::MovesAsLike;

lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6686,11 +6686,11 @@ void MissingGenericArgumentsFailure::emitGenericSignatureNote(
66866686
}))
66876687
continue;
66886688

6689-
params[cast<GenericTypeParamType>(GP->getCanonicalType())] = type;
6689+
params[GP] = type;
66906690
}
66916691

66926692
auto getPreferredType = [&](const GenericTypeParamType *GP) -> Type {
6693-
auto type = params.find(cast<GenericTypeParamType>(GP->getCanonicalType()));
6693+
auto type = params.find(GP);
66946694
return (type == params.end()) ? Type() : type->second;
66956695
};
66966696

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5157,6 +5157,7 @@ TypeResolver::resolveIntegerTypeRepr(IntegerTypeRepr *repr,
51575157
TypeResolutionOptions options) {
51585158
if (!options.is(TypeResolverContext::ValueGenericArgument) &&
51595159
!options.is(TypeResolverContext::SameTypeRequirement) &&
5160+
!options.is(TypeResolverContext::RawLayoutAttr) &&
51605161
!options.contains(TypeResolutionFlags::SILMode)) {
51615162
diagnoseInvalid(repr, repr->getLoc(),
51625163
diag::integer_type_not_accepted);

test/IRGen/raw_layout.swift

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -369,22 +369,32 @@ entry(%0 : $*Cell<T>):
369369
// CHECK: [[T_VWT_ADDR:%.*]] = getelementptr inbounds ptr, ptr [[T]], {{i64|i32}} -1
370370
// CHECK-NEXT: {{%.*}} = load ptr, ptr [[T_VWT_ADDR]]
371371
// CHECK: [[T_LAYOUT:%.*]] = getelementptr inbounds ptr, ptr {{%.*}}, i32 8
372-
// CHECK-NEXT: call void @swift_initRawStructMetadata(ptr %"Cell<T>", {{i64|i32}} 0, ptr [[T_LAYOUT]], {{i64|i32}} -1)
372+
// CHECK-NEXT: call void @swift_initRawStructMetadata(ptr %"Cell<T>", {{i64|i32}} 0, ptr [[T_LAYOUT]], {{i64|i32}} 0, {{i64|i32}} 0)
373373

374374
// PaddedCell<T>
375375

376376
// CHECK-LABEL: define {{.*}} swiftcc %swift.metadata_response @"$s{{[A-Za-z0-9_]*}}10PaddedCellVMr"(ptr %"PaddedCell<T>", ptr {{.*}}, ptr {{.*}})
377-
// CHECK: call void @swift_initRawStructMetadata(ptr %"PaddedCell<T>", {{i64|i32}} 0, ptr {{%.*}}, {{i64|i32}} 1)
377+
// CHECK: call void @swift_initRawStructMetadata(ptr %"PaddedCell<T>", {{i64|i32}} 0, ptr {{%.*}}, {{i64|i32}} 1, {{i64|i32}} 1)
378378

379379
// SmallVectorBuf<T>
380380

381381
// CHECK-LABEL: define {{.*}} swiftcc %swift.metadata_response @"$s{{[A-Za-z0-9_]*}}14SmallVectorBufVMr"(ptr %"SmallVectorBuf<T>", ptr {{.*}}, ptr {{.*}})
382-
// CHECK: call void @swift_initRawStructMetadata(ptr %"SmallVectorBuf<T>", {{i64|i32}} 0, ptr {{%.*}}, {{i64|i32}} 8)
382+
// CHECK: call void @swift_initRawStructMetadata(ptr %"SmallVectorBuf<T>", {{i64|i32}} 0, ptr {{%.*}}, {{i64|i32}} 8, {{i64|i32}} 1)
383+
384+
// Vector<T, N>
385+
386+
// CHECK-LABEL: define {{.*}} swiftcc %swift.metadata_response @"$s{{[A-Za-z0-9_]*}}6VectorVMr"(ptr %"Vector<T, N>", ptr {{.*}}, ptr {{.*}})
387+
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"Vector<T, N>", {{i64|i32}} 3
388+
// CHECK-NEXT: [[N:%.*]] = load {{i64|i32}}, ptr [[N_GEP]]
389+
// CHECK: call void @swift_initRawStructMetadata(ptr %"Vector<T, N>", {{i64|i32}} 0, ptr {{%.*}}, {{i64|i32}} [[N]], {{i64|i32}} 1)
383390

384391
//===----------------------------------------------------------------------===//
385-
// Ensure that 'movesAsLike' is correctly calling the underlying type's move constructor
392+
// CellThatMovesAsLike<T> Dependent layout metadata initialization
386393
//===----------------------------------------------------------------------===//
387394

395+
// CHECK-LABEL: define {{.*}} swiftcc %swift.metadata_response @"$s{{[A-Za-z0-9_]*}}19CellThatMovesAsLikeVMr"(ptr %"CellThatMovesAsLike<T>", ptr {{.*}}, ptr {{.*}})
396+
// CHECK: call void @swift_initRawStructMetadata(ptr %"CellThatMovesAsLike<T>", {{i64|i32}} 0, ptr {{%.*}}, {{i64|i32}} 0, {{i64|i32}} 2)
397+
388398
//===----------------------------------------------------------------------===//
389399
// CellThatMovesAsLike<T> destroy
390400
//===----------------------------------------------------------------------===//
@@ -613,12 +623,21 @@ entry(%0 : $*Cell<T>):
613623
// CHECK: ret ptr %dest
614624

615625
//===----------------------------------------------------------------------===//
616-
// Vector destroy
626+
// VectorMovesAsLike Dependent layout metadata initialization
627+
//===----------------------------------------------------------------------===//
628+
629+
// CHECK-LABEL: define {{.*}} swiftcc %swift.metadata_response @"$s{{[A-Za-z0-9_]*}}17VectorMovesAsLikeVMr"(ptr %"VectorMovesAsLike<T, N>", ptr {{.*}}, ptr {{.*}})
630+
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 3
631+
// CHECK-NEXT: [[N:%.*]] = load {{i64|i32}}, ptr [[N_GEP]]
632+
// CHECK: call void @swift_initRawStructMetadata(ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 0, ptr {{%.*}}, {{i64|i32}} [[N]], {{i64|i32}} 3)
633+
634+
//===----------------------------------------------------------------------===//
635+
// VectorMovesAsLike destroy
617636
//===----------------------------------------------------------------------===//
618637

619-
// CHECK-LABEL: define {{.*}} void @"$s10raw_layout17VectorMovesAsLikeVwxx"(ptr {{.*}} %object, ptr %"VectorMovesAsLike<T, let N>")
638+
// CHECK-LABEL: define {{.*}} void @"$s10raw_layout17VectorMovesAsLikeVwxx"(ptr {{.*}} %object, ptr %"VectorMovesAsLike<T, N>")
620639
// CHECK: [[I_ALLOCA:%.*]] = alloca {{i64|i32}}
621-
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"VectorMovesAsLike<T, let N>", {{i64|i32}} 3
640+
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 3
622641
// CHECK-NEXT: [[N:%.*]] = load {{i64|i32}}, ptr [[N_GEP]]
623642
// CHECK: store {{i64|i32}} 0, ptr [[I_ALLOCA]]
624643
// CHECK: br label %[[COND_BR:.*]]
@@ -631,7 +650,7 @@ entry(%0 : $*Cell<T>):
631650
// CHECK: [[LOOP_BR]]:
632651
// CHECK: [[NEW_I:%.*]] = add {{i64|i32}} [[I]], 1
633652
// CHECK: store {{i64|i32}} [[NEW_I]], ptr [[I_ALLOCA]]
634-
// CHECK: [[T_ADDR:%.*]] = getelementptr inbounds ptr, ptr %"VectorMovesAsLike<T, let N>", {{i64|i32}} 2
653+
// CHECK: [[T_ADDR:%.*]] = getelementptr inbounds ptr, ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 2
635654
// CHECK-NEXT: [[T:%.*]] = load ptr, ptr [[T_ADDR]]
636655
// CHECK: [[STRIDE_GEP:%.*]] = getelementptr inbounds %swift.vwtable, ptr {{%.*}}, i32 0, i32 9
637656
// CHECK-NEXT: [[STRIDE:%.*]] = load {{i64|i32}}, ptr [[STRIDE_GEP]]
@@ -645,12 +664,12 @@ entry(%0 : $*Cell<T>):
645664
// CHECK: ret void
646665

647666
//===----------------------------------------------------------------------===//
648-
// Vector initializeWithTake
667+
// VectorMovesAsLike initializeWithTake
649668
//===----------------------------------------------------------------------===//
650669

651-
// CHECK-LABEL: define {{.*}} ptr @"$s10raw_layout17VectorMovesAsLikeVwtk"(ptr {{.*}} %dest, ptr {{.*}} %src, ptr %"VectorMovesAsLike<T, let N>")
670+
// CHECK-LABEL: define {{.*}} ptr @"$s10raw_layout17VectorMovesAsLikeVwtk"(ptr {{.*}} %dest, ptr {{.*}} %src, ptr %"VectorMovesAsLike<T, N>")
652671
// CHECK: [[I_ALLOCA:%.*]] = alloca {{i64|i32}}
653-
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"VectorMovesAsLike<T, let N>", {{i64|i32}} 3
672+
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 3
654673
// CHECK-NEXT: [[N:%.*]] = load {{i64|i32}}, ptr [[N_GEP]]
655674
// CHECK: store {{i64|i32}} 0, ptr [[I_ALLOCA]]
656675
// CHECK: br label %[[COND_BR:.*]]
@@ -663,7 +682,7 @@ entry(%0 : $*Cell<T>):
663682
// CHECK: [[LOOP_BR]]:
664683
// CHECK: [[NEW_I:%.*]] = add {{i64|i32}} [[I]], 1
665684
// CHECK: store {{i64|i32}} [[NEW_I]], ptr [[I_ALLOCA]]
666-
// CHECK: [[T_ADDR:%.*]] = getelementptr inbounds ptr, ptr %"VectorMovesAsLike<T, let N>", {{i64|i32}} 2
685+
// CHECK: [[T_ADDR:%.*]] = getelementptr inbounds ptr, ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 2
667686
// CHECK-NEXT: [[T:%.*]] = load ptr, ptr [[T_ADDR]]
668687
// CHECK: [[STRIDE_GEP:%.*]] = getelementptr inbounds %swift.vwtable, ptr {{%.*}}, i32 0, i32 9
669688
// CHECK-NEXT: [[STRIDE:%.*]] = load {{i64|i32}}, ptr [[STRIDE_GEP]]
@@ -678,12 +697,12 @@ entry(%0 : $*Cell<T>):
678697
// CHECK: ret ptr %dest
679698

680699
//===----------------------------------------------------------------------===//
681-
// Vector assignWithTake
700+
// VectorMovesAsLike assignWithTake
682701
//===----------------------------------------------------------------------===//
683702

684-
// CHECK-LABEL: define {{.*}} ptr @"$s10raw_layout17VectorMovesAsLikeVwta"(ptr {{.*}} %dest, ptr {{.*}} %src, ptr %"VectorMovesAsLike<T, let N>")
703+
// CHECK-LABEL: define {{.*}} ptr @"$s10raw_layout17VectorMovesAsLikeVwta"(ptr {{.*}} %dest, ptr {{.*}} %src, ptr %"VectorMovesAsLike<T, N>")
685704
// CHECK: [[I_ALLOCA:%.*]] = alloca {{i64|i32}}
686-
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"VectorMovesAsLike<T, let N>", {{i64|i32}} 3
705+
// CHECK: [[N_GEP:%.*]] = getelementptr inbounds {{i64|i32}}, ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 3
687706
// CHECK-NEXT: [[N:%.*]] = load {{i64|i32}}, ptr [[N_GEP]]
688707
// CHECK: store {{i64|i32}} 0, ptr [[I_ALLOCA]]
689708
// CHECK: br label %[[COND_BR:.*]]
@@ -696,7 +715,7 @@ entry(%0 : $*Cell<T>):
696715
// CHECK: [[LOOP_BR]]:
697716
// CHECK: [[NEW_I:%.*]] = add {{i64|i32}} [[I]], 1
698717
// CHECK: store {{i64|i32}} [[NEW_I]], ptr [[I_ALLOCA]]
699-
// CHECK: [[T_ADDR:%.*]] = getelementptr inbounds ptr, ptr %"VectorMovesAsLike<T, let N>", {{i64|i32}} 2
718+
// CHECK: [[T_ADDR:%.*]] = getelementptr inbounds ptr, ptr %"VectorMovesAsLike<T, N>", {{i64|i32}} 2
700719
// CHECK-NEXT: [[T:%.*]] = load ptr, ptr [[T_ADDR]]
701720
// CHECK: [[STRIDE_GEP:%.*]] = getelementptr inbounds %swift.vwtable, ptr {{%.*}}, i32 0, i32 9
702721
// CHECK-NEXT: [[STRIDE:%.*]] = load {{i64|i32}}, ptr [[STRIDE_GEP]]

test/attr/attr_implements_bad_parse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %target-swift-frontend -parse -verify %s
22

33
struct S0 {
4-
@_implements(1, Foo) // expected-error {{expected type}}
4+
@_implements(1, Foo) // OK. We can parse integers as types now, so this is fine. We will diagnose its incorrect usage during type checking.
55
func f() { }
66
}
77

test/expr/postfix/init/unqualified.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Theodosia: Aaron {
6262

6363
// FIXME: We could optimistically parse this as an expression instead
6464
// expected-error@+2 {{initializers may only be declared within a type}}
65-
// expected-error@+1 {{expected parameter type following ':'}}
65+
// expected-error@+1 {{integer unexpectedly used in a type position}}
6666
init(z: 0)
6767
}
6868

@@ -98,7 +98,7 @@ struct AaronStruct {
9898

9999
// FIXME: We could optimistically parse this as an expression instead
100100
// expected-error@+2 {{initializers may only be declared within a type}}
101-
// expected-error@+1 {{expected parameter type following ':'}}
101+
// expected-error@+1 {{integer unexpectedly used in a type position}}
102102
init(y: 1)
103103
}
104104

0 commit comments

Comments
 (0)