|
|
@@ -2,7 +2,7 @@
|
|
|
// Exceptions. See /LICENSE for license information.
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
//
|
|
|
-// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon
|
|
|
+// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
|
|
|
//
|
|
|
// AUTOUPDATE
|
|
|
// TIP: To test this file alone, run:
|
|
|
@@ -13,95 +13,114 @@
|
|
|
// --- fail_incomplete_interface.carbon
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
|
|
-interface A;
|
|
|
-interface B {}
|
|
|
+interface X;
|
|
|
class C {}
|
|
|
|
|
|
-fn G[T:! A](t: T) {}
|
|
|
-fn H[T:! A & B](t: T) {}
|
|
|
+// Requires X identified.
|
|
|
+impl C as X;
|
|
|
|
|
|
-fn F() {
|
|
|
- // CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE+4]]:3: error: cannot convert type `C` into type implementing `A` [ConversionFailureTypeToFacet]
|
|
|
- // CHECK:STDERR: C as A;
|
|
|
- // CHECK:STDERR: ^~~~~~
|
|
|
- // CHECK:STDERR:
|
|
|
- C as A;
|
|
|
+// Requires X complete.
|
|
|
+// CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `X` [ImplAsIncompleteFacetTypeDefinition]
|
|
|
+// CHECK:STDERR: impl C as X {}
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
+// CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE-10]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
|
|
|
+// CHECK:STDERR: interface X;
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~
|
|
|
+// CHECK:STDERR:
|
|
|
+impl C as X {}
|
|
|
|
|
|
- // CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE+4]]:3: error: cannot convert type `C` into type implementing `A & B` [ConversionFailureTypeToFacet]
|
|
|
- // CHECK:STDERR: C as (A & B);
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~
|
|
|
- // CHECK:STDERR:
|
|
|
- C as (A & B);
|
|
|
-
|
|
|
- // CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `A` [ConversionFailureTypeToFacet]
|
|
|
- // CHECK:STDERR: G({} as C);
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE-19]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
|
|
- // CHECK:STDERR: fn G[T:! A](t: T) {}
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
|
|
- // CHECK:STDERR:
|
|
|
- G({} as C);
|
|
|
-
|
|
|
- // CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE+7]]:3: error: cannot convert type `C` into type implementing `A & B` [ConversionFailureTypeToFacet]
|
|
|
- // CHECK:STDERR: H({} as C);
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_interface.carbon:[[@LINE-27]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
|
|
- // CHECK:STDERR: fn H[T:! A & B](t: T) {}
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
|
|
- // CHECK:STDERR:
|
|
|
- H({} as C);
|
|
|
+// --- fail_incomplete_interface_without_forward_decl.carbon
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+interface X;
|
|
|
+class C {}
|
|
|
+
|
|
|
+// Requires X complete.
|
|
|
+// CHECK:STDERR: fail_incomplete_interface_without_forward_decl.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `X` [ImplAsIncompleteFacetTypeDefinition]
|
|
|
+// CHECK:STDERR: impl C as X {}
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
+// CHECK:STDERR: fail_incomplete_interface_without_forward_decl.carbon:[[@LINE-7]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
|
|
|
+// CHECK:STDERR: interface X;
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~
|
|
|
+// CHECK:STDERR:
|
|
|
+impl C as X {}
|
|
|
+
|
|
|
+// --- fail_unidentified_constraint.carbon
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+constraint X;
|
|
|
+class C {}
|
|
|
+
|
|
|
+// Requires X identified.
|
|
|
+// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE+7]]:1: error: facet type `X` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType]
|
|
|
+// CHECK:STDERR: impl C as X;
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~
|
|
|
+// CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE-7]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
|
|
|
+// CHECK:STDERR: constraint X;
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
+// CHECK:STDERR:
|
|
|
+impl C as X;
|
|
|
+
|
|
|
+// --- nested_require_incomplete_interface.carbon
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
+
|
|
|
+interface Z;
|
|
|
+constraint Y {
|
|
|
+ require impls Z;
|
|
|
}
|
|
|
+interface X {
|
|
|
+ require impls Y;
|
|
|
+}
|
|
|
+
|
|
|
+class C {}
|
|
|
+
|
|
|
+// Requires X identified.
|
|
|
+impl C as X;
|
|
|
+
|
|
|
+// Requires X complete.
|
|
|
+impl C as X {}
|
|
|
|
|
|
-// --- fail_incomplete_constraint.carbon
|
|
|
+// --- fail_incomplete_through_constraint.carbon
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
|
|
-constraint A;
|
|
|
-interface B {}
|
|
|
+interface Z;
|
|
|
+constraint Y {
|
|
|
+ extend require impls Z;
|
|
|
+}
|
|
|
+
|
|
|
class C {}
|
|
|
|
|
|
-fn G[T:! A](t: T) {}
|
|
|
-fn H[T:! A & B](t: T) {}
|
|
|
+// Requires Y identified.
|
|
|
+impl C as Y;
|
|
|
|
|
|
-fn F() {
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+7]]:3: error: facet type `A` is incomplete [ImplLookupInIncompleteFacetType]
|
|
|
- // CHECK:STDERR: C as A;
|
|
|
- // CHECK:STDERR: ^~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-11]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
|
|
|
- // CHECK:STDERR: constraint A;
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
- // CHECK:STDERR:
|
|
|
- C as A;
|
|
|
+// Requires Y complete.
|
|
|
+// CHECK:STDERR: fail_incomplete_through_constraint.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `Y` [ImplAsIncompleteFacetTypeDefinition]
|
|
|
+// CHECK:STDERR: impl C as Y {}
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
+// CHECK:STDERR: fail_incomplete_through_constraint.carbon:[[@LINE-14]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
|
|
|
+// CHECK:STDERR: interface Z;
|
|
|
+// CHECK:STDERR: ^~~~~~~~~~~~
|
|
|
+// CHECK:STDERR:
|
|
|
+impl C as Y {}
|
|
|
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+7]]:3: error: facet type `B & A` is incomplete [ImplLookupInIncompleteFacetType]
|
|
|
- // CHECK:STDERR: C as (A & B);
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-20]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
|
|
|
- // CHECK:STDERR: constraint A;
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
- // CHECK:STDERR:
|
|
|
- C as (A & B);
|
|
|
+// --- fail_impl_lookup_incomplete.carbon
|
|
|
+library "[[@TEST_NAME]]";
|
|
|
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+10]]:3: error: facet type `A` is incomplete [ImplLookupInIncompleteFacetType]
|
|
|
- // CHECK:STDERR: G({} as C);
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-29]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
|
|
|
- // CHECK:STDERR: constraint A;
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-28]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
|
|
- // CHECK:STDERR: fn G[T:! A](t: T) {}
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
|
|
- // CHECK:STDERR:
|
|
|
- G({} as C);
|
|
|
+constraint Z;
|
|
|
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+10]]:3: error: facet type `B & A` is incomplete [ImplLookupInIncompleteFacetType]
|
|
|
- // CHECK:STDERR: H({} as C);
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-41]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
|
|
|
- // CHECK:STDERR: constraint A;
|
|
|
+fn AsZ(T:! Z) {}
|
|
|
+
|
|
|
+fn F() {
|
|
|
+ // Requires Z identified.
|
|
|
+ // CHECK:STDERR: fail_impl_lookup_incomplete.carbon:[[@LINE+10]]:3: error: facet type `Z` can not be identified [ImplLookupInUnidentifiedFacetType]
|
|
|
+ // CHECK:STDERR: AsZ(());
|
|
|
+ // CHECK:STDERR: ^~~~~~~
|
|
|
+ // CHECK:STDERR: fail_impl_lookup_incomplete.carbon:[[@LINE-9]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
|
|
|
+ // CHECK:STDERR: constraint Z;
|
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~
|
|
|
- // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-39]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
|
|
|
- // CHECK:STDERR: fn H[T:! A & B](t: T) {}
|
|
|
- // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~
|
|
|
+ // CHECK:STDERR: fail_impl_lookup_incomplete.carbon:[[@LINE-10]]:8: note: initializing generic parameter `T` declared here [InitializingGenericParam]
|
|
|
+ // CHECK:STDERR: fn AsZ(T:! Z) {}
|
|
|
+ // CHECK:STDERR: ^
|
|
|
// CHECK:STDERR:
|
|
|
- H({} as C);
|
|
|
+ AsZ(());
|
|
|
}
|