mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SE-0361] Update tests for bound generic extensions.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name Test -enable-experimental-bound-generic-extensions
|
||||
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name Test
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Test
|
||||
// RUN: %FileCheck %s < %t.swiftinterface
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-emit-silgen -enable-experimental-bound-generic-extensions %s | %FileCheck %s
|
||||
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
|
||||
|
||||
struct Tree<T> {
|
||||
struct Branch<B> {
|
||||
|
||||
@@ -40,8 +40,6 @@ func nestingTest6() {
|
||||
extension Array {
|
||||
func foo() {
|
||||
extension Array { // expected-error {{declaration is only valid at file scope}}
|
||||
// FIXME: Confusing error
|
||||
// expected-error@-2 {{constrained extension must be declared on the unspecialized generic type 'Array' with constraints specified by a 'where' clause}}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -347,7 +345,8 @@ extension Tree.LimbContent.Contents {
|
||||
}
|
||||
|
||||
extension Tree.BoughPayload.Contents {
|
||||
// expected-error@-1 {{constrained extension must be declared on the unspecialized generic type 'Nest'}}
|
||||
// expected-error@-1 {{extension of type 'Tree.BoughPayload.Contents' (aka 'Nest<Int>') must be declared as an extension of 'Nest<Int>'}}
|
||||
// expected-note@-2 {{did you mean to extend 'Nest<Int>' instead?}}
|
||||
}
|
||||
|
||||
// SR-10466 Check 'where' clause when referencing type defined inside extension
|
||||
|
||||
@@ -19,11 +19,9 @@ extension Double : P2 {
|
||||
}
|
||||
|
||||
extension X<Int, Double, String> {
|
||||
// expected-error@-1{{constrained extension must be declared on the unspecialized generic type 'X' with constraints specified by a 'where' clause}}
|
||||
let x = 0
|
||||
// expected-error@-1 {{extensions must not contain stored properties}}
|
||||
static let x = 0
|
||||
// expected-error@-1 {{static stored properties not supported in generic types}}
|
||||
func f() -> Int {}
|
||||
class C<T> {}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-typecheck-verify-swift -enable-experimental-bound-generic-extensions
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
extension Array<Int> {
|
||||
func someIntFuncOnArray() {}
|
||||
|
||||
@@ -307,9 +307,9 @@ func takesSugaredType2(m: GenericClass<Int>.TA<Float>) {
|
||||
extension A {}
|
||||
|
||||
extension A<T> {} // expected-error {{generic type 'A' specialized with too few type parameters (got 1, but expected 2)}}
|
||||
extension A<Float,Int> {} // expected-error {{constrained extension must be declared on the unspecialized generic type 'MyType' with constraints specified by a 'where' clause}}
|
||||
extension A<Float,Int> {}
|
||||
extension C<T> {} // expected-error {{cannot find type 'T' in scope}}
|
||||
extension C<Int> {} // expected-error {{constrained extension must be declared on the unspecialized generic type 'MyType' with constraints specified by a 'where' clause}}
|
||||
extension C<Int> {}
|
||||
|
||||
|
||||
protocol ErrorQ {
|
||||
|
||||
Reference in New Issue
Block a user