Skip to content

Commit b9dec7d

Browse files
[test] Adjusting tests for generic parameters that are now being aka on diagnostics
1 parent 4047dd9 commit b9dec7d

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

lib/AST/DiagnosticEngine.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,18 +455,17 @@ static bool typeSpellingIsAmbiguous(Type type,
455455
return false;
456456
}
457457

458-
/// Walks the type recursivelly desugaring types to display, but skiping
459-
/// `GenericTypeParamType` because we would lose association with it's original
458+
/// Walks the type recursivelly desugaring types to display, but skipping
459+
/// `GenericTypeParamType` because we would lose association with its original
460460
/// declaration and end up presenting the parameter in τ_0_0 format on
461461
/// diagnostic.
462462
static Type getAkaTypeForDisplay(Type type) {
463-
auto Func = [](Type visitTy) -> Type {
463+
return type.transform([](Type visitTy) -> Type {
464464
if (isa<SugarType>(visitTy.getPointer()) &&
465465
!isa<GenericTypeParamType>(visitTy.getPointer()))
466466
return getAkaTypeForDisplay(visitTy->getDesugaredType());
467467
return visitTy;
468-
};
469-
return type.transform(Func).getPointer();
468+
});
470469
}
471470

472471
/// Format a single diagnostic argument and write it to the given

test/AutoDiff/Sema/differentiable_attr_type_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ struct TF_521<T: FloatingPoint> {
392392
}
393393
// expected-error @+1 {{type 'TF_521<T>' does not conform to protocol 'Differentiable'}}
394394
extension TF_521: Differentiable where T: Differentiable {
395-
// expected-note @+1 {{possibly intended match 'TF_521<T>.TangentVector' does not conform to 'AdditiveArithmetic'}}
395+
// expected-note @+1 {{possibly intended match 'TF_521<T>.TangentVector' (aka 'TF_521<T>') does not conform to 'AdditiveArithmetic'}}
396396
typealias TangentVector = TF_521
397397
}
398398
// expected-error @+1 {{result type 'TF_521<Float>' does not conform to 'Differentiable', but the enclosing function type is '@differentiable'}}

test/ClangImporter/objc_generics_conformance.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protocol WithAssocOther {
2121
}
2222

2323
extension GenericClass : WithAssocOther {
24-
typealias Other = [T] // expected-error{{type 'GenericClass<T>.Other' involving Objective-C type parameter 'T' cannot be used for associated type 'Other' of protocol 'WithAssocOther'}}
24+
typealias Other = [T] // expected-error{{type 'GenericClass<T>.Other' (aka 'Array<T>') involving Objective-C type parameter 'T' cannot be used for associated type 'Other' of protocol 'WithAssocOther'}}
2525
}
2626

2727
protocol WithAssocSeparate {
@@ -31,7 +31,7 @@ protocol WithAssocSeparate {
3131
extension GenericClass {
3232
typealias Separate = T // expected-note {{'Separate' declared here}}
3333
}
34-
extension GenericClass : WithAssocSeparate { // expected-error {{type 'GenericClass<T>.Separate' involving Objective-C type parameter 'T' cannot be used for associated type 'Separate' of protocol 'WithAssocSeparate'}}
34+
extension GenericClass : WithAssocSeparate { // expected-error {{type 'GenericClass<T>.Separate' (aka 'T') involving Objective-C type parameter 'T' cannot be used for associated type 'Separate' of protocol 'WithAssocSeparate'}}
3535
}
3636

3737
protocol WithAssocElement {

test/Constraints/conditionally_defined_types.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let _ = SameType<X>.Decl3.self
3636
let _ = SameType<X>.Decl4<X>.self
3737
let _ = SameType<X>.Decl5<X>.self
3838

39-
let _ = SameType<Y>.TypeAlias1.self // expected-error {{'SameType<T>.TypeAlias1' requires the types 'Y' and 'X' be equivalent}}
39+
let _ = SameType<Y>.TypeAlias1.self // expected-error {{'SameType<T>.TypeAlias1' (aka 'T') requires the types 'Y' and 'X' be equivalent}}
4040
let _ = SameType<Y>.TypeAlias2.self // expected-error {{'SameType<T>.TypeAlias2' (aka 'Y') requires the types 'Y' and 'X' be equivalent}}
4141
let _ = SameType<Y>.TypeAlias3<X>.self // expected-error {{'SameType<Y>.TypeAlias3' requires the types 'Y' and 'X' be equivalent}}
4242
let _ = SameType<Y>.Decl1.self // expected-error {{'SameType<T>.Decl1' requires the types 'Y' and 'X' be equivalent}}
@@ -144,7 +144,7 @@ let _ = SameType<X>.Decl4<X>.Decl3.self
144144
let _ = SameType<X>.Decl4<X>.Decl4<X>.self
145145
let _ = SameType<X>.Decl4<X>.Decl5<X>.self
146146

147-
let _ = SameType<X>.Decl4<Y>.TypeAlias1.self // expected-error {{'SameType<T>.Decl4<U>.TypeAlias1' requires the types 'Y' and 'X' be equivalent}}
147+
let _ = SameType<X>.Decl4<Y>.TypeAlias1.self // expected-error {{'SameType<T>.Decl4<U>.TypeAlias1' (aka 'T') requires the types 'Y' and 'X' be equivalent}}
148148
let _ = SameType<X>.Decl4<Y>.TypeAlias2.self // expected-error {{'SameType<T>.Decl4<U>.TypeAlias2' (aka 'Y') requires the types 'Y' and 'X' be equivalent}}
149149
let _ = SameType<X>.Decl4<Y>.TypeAlias3<X>.self // expected-error {{'SameType<X>.Decl4<Y>.TypeAlias3' requires the types 'Y' and 'X' be equivalent}}
150150
let _ = SameType<X>.Decl4<Y>.Decl1.self // expected-error {{'SameType<T>.Decl4<U>.Decl1' requires the types 'Y' and 'X' be equivalent}}

test/Generics/protocol_type_aliases.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func requirementOnConcreteNestedTypeAlias<T>(_: T) where T: Q2, T.C == T.B.X {}
3535
// CHECK-LABEL: .concreteRequirementOnConcreteNestedTypeAlias@
3636
// CHECK: Canonical generic signature: <τ_0_0 where τ_0_0 : Q2, τ_0_0.C == τ_0_0.B.A>
3737
func concreteRequirementOnConcreteNestedTypeAlias<T>(_: T) where T: Q2, S<T.C> == T.B.X {}
38-
// expected-warning@-1 {{neither type in same-type constraint ('S<T.C>' or 'T.B.X') refers to a generic parameter or associated type}}
38+
// expected-warning@-1 {{neither type in same-type constraint ('S<T.C>' or 'T.B.X' (aka 'S<T.B.A>')) refers to a generic parameter or associated type}}
3939

4040

4141
// Incompatible concrete typealias types are flagged as such

test/ImportResolution/import-specific-fixits.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import struct DeclsUsedWrongly.Choice // expected-error {{'Choice' was imported
3636
import struct DeclsUsedWrongly.Callback // expected-error {{type alias 'Callback' (aka '() -> ()') cannot be imported as 'struct'}} {{8-14=typealias}}
3737
import var DeclsUsedWrongly.Callback // expected-error {{'Callback' was imported as 'var', but is a type}} {{8-11=typealias}}
3838

39-
import struct DeclsUsedWrongly.Pair // expected-error {{type alias 'Pair' cannot be imported as 'struct'}} {{8-14=typealias}}
39+
import struct DeclsUsedWrongly.Pair // expected-error {{type alias 'Pair' (aka '(T, T)') cannot be imported as 'struct'}} {{8-14=typealias}}
4040
import var DeclsUsedWrongly.Pair // expected-error {{'Pair' was imported as 'var', but is a type}} {{8-11=typealias}}
4141

4242
import struct Swift.print // expected-error {{'print' was imported as 'struct', but is a function}} {{8-14=func}}

validation-test/compiler_crashers_2_fixed/sr12990.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class ContainerTransition {
55
func completeTransition() {
66
viewControllers?[Int//.max
77
// expected-error@-1 {{no exact matches in call to subscript}}
8-
// expected-note@-2 {{found candidate with type '((Int).Type) -> Dictionary<Int, String>.SubSequence' (aka '(Int.Type) -> Slice<Dictionary<Int, String>>')}}
8+
// expected-note@-2 {{found candidate with type '((Int).Type) -> Dictionary<Int, String>.SubSequence' (aka '((Int).Type) -> Slice<Dictionary<Int, String>>')}}
99
// expected-note@-3 {{to match this opening '['}}
1010
} // expected-error {{expected ']' in expression list}}
1111
}

0 commit comments

Comments
 (0)