Provide local paths for file tests. (#2830)

The intent of this change is that instead of paths looking like `explorer/testdata/foo/bar.carbon` (repo-relative), they're now just `bar.carbon` (local). The consequence is that paths should be a bit more durable in various environments, and just paths should be shorter and easier to read.

The explorer's prelude is an exception to this since it comes from data, rather than being the test target. Due to the change in approaches, it needs the regex again.

Uses #2829
This commit is contained in:
Jon Ross-Perkins
2023-05-18 10:20:51 -07:00
committed by GitHub
parent 3c15882f4e
commit 6b7a522b3f
495 changed files with 701 additions and 641 deletions
+18 -10
View File
@@ -8,23 +8,24 @@
namespace Carbon::Testing {
namespace {
static constexpr char PreludePath[] = "explorer/data/prelude.carbon";
class ParseAndExecuteTestFile : public FileTestBase {
public:
explicit ParseAndExecuteTestFile(llvm::StringRef path, bool trace)
explicit ParseAndExecuteTestFile(const std::filesystem::path& path,
bool trace)
: FileTestBase(path), trace_(trace) {}
auto SetUp() -> void override {
if (trace_) {
if (path().find("/limits/") != llvm::StringRef::npos) {
std::string path_str = path().string();
llvm::StringRef path_ref = path_str;
if (path_ref.find("/limits/") != llvm::StringRef::npos) {
GTEST_SKIP()
<< "`limits` tests check for various limit conditions (such as an "
"infinite loop). The tests collectively don't test tracing "
"because it creates substantial additional overhead.";
} else if (path().endswith(
} else if (path_ref.endswith(
"testdata/assoc_const/rewrite_large_type.carbon") ||
path().endswith(
path_ref.endswith(
"testdata/linked_list/typed_linked_list.carbon")) {
GTEST_SKIP() << "Expensive test to trace";
}
@@ -41,10 +42,16 @@ class ParseAndExecuteTestFile : public FileTestBase {
trace_stream.set_stream(&trace_stream_ostream);
}
// Set the location of the prelude.
char* test_srcdir = getenv("TEST_SRCDIR");
CARBON_CHECK(test_srcdir != nullptr);
std::string prelude_path(test_srcdir);
prelude_path += "/carbon/explorer/data/prelude.carbon";
// Run the parse. Parser debug output is always off because it's difficult
// to redirect.
auto result =
ParseAndExecuteFile(PreludePath, path().str(),
ParseAndExecuteFile(prelude_path, path().filename().string(),
/*parser_debug=*/false, &trace_stream, &stdout);
// This mirrors printing currently done by main.cpp.
if (result.ok()) {
@@ -67,14 +74,15 @@ class ParseAndExecuteTestFile : public FileTestBase {
} // namespace
extern auto RegisterFileTests(const std::vector<llvm::StringRef>& paths)
extern auto RegisterFileTests(const std::vector<std::filesystem::path>& paths)
-> void {
ParseAndExecuteTestFile::RegisterTests(
"ParseAndExecuteTestFile", paths, [=](llvm::StringRef path) {
"ParseAndExecuteTestFile", paths, [=](const std::filesystem::path& path) {
return new ParseAndExecuteTestFile(path, /*trace=*/false);
});
ParseAndExecuteTestFile::RegisterTests(
"ParseAndExecuteTestFile.trace", paths, [=](llvm::StringRef path) {
"ParseAndExecuteTestFile.trace", paths,
[=](const std::filesystem::path& path) {
return new ParseAndExecuteTestFile(path, /*trace=*/true);
});
}
+1 -1
View File
@@ -24,7 +24,7 @@ class Point {
fn Main() -> i32 {
let p: Point = Point.Origin();
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/addr/fail_method_let.carbon:[[@LINE+1]]: method p.GetSetX requires its receiver to be a reference expression
// CHECK:STDERR: COMPILATION ERROR: fail_method_let.carbon:[[@LINE+1]]: method p.GetSetX requires its receiver to be a reference expression
var x: auto = p.GetSetX(42);
if (p.x == 42) {
return x;
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
class C {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/addr/fail_method_self_misspelled.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
// CHECK:STDERR: SYNTAX ERROR: fail_method_self_misspelled.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
fn F[addr slef: Self*]() {}
}
+1 -1
View File
@@ -28,7 +28,7 @@ class Point {
fn Main() -> i32 {
var p: Point = Point.Origin();
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/addr/fail_method_self_type.carbon:[[@LINE+3]]: type error in method access, receiver type
// CHECK:STDERR: COMPILATION ERROR: fail_method_self_type.carbon:[[@LINE+3]]: type error in method access, receiver type
// CHECK:STDERR: expected: class Shape
// CHECK:STDERR: actual: class Point
var x: auto = p.GetSetX(42);
+1 -1
View File
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_alias_expression.carbon:[[@LINE+1]]: invalid target for alias declaration
// CHECK:STDERR: COMPILATION ERROR: fail_alias_expression.carbon:[[@LINE+1]]: invalid target for alias declaration
alias A = 5;
fn Main() -> i32 { return 0; }
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
var v: i32;
// TODO: This should probably be valid if we allow global variables at all.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_alias_var.carbon:[[@LINE+1]]: invalid target for alias declaration
// CHECK:STDERR: COMPILATION ERROR: fail_alias_var.carbon:[[@LINE+1]]: invalid target for alias declaration
alias A = v;
fn Main() -> i32 { return 0; }
@@ -33,7 +33,7 @@ impl forall [U:! Printable] Vector(U) as Printable {
fn Main() -> i32 {
var v: Vector(String) = {.x = "test"};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_interface_method_as_class_member.carbon:[[@LINE+1]]: Member access to aliases is not yet supported.
// CHECK:STDERR: COMPILATION ERROR: fail_interface_method_as_class_member.carbon:[[@LINE+1]]: Member access to aliases is not yet supported.
v.PrintIt();
return 42;
}
+1 -1
View File
@@ -10,7 +10,7 @@ namespace N;
alias M = N;
// TODO: It's unclear whether this should be permitted. If not, we should
// produce a better diagnostic.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_namespace_alias_member.carbon:[[@LINE+1]]: alias M cannot be used as a name qualifier
// CHECK:STDERR: COMPILATION ERROR: fail_namespace_alias_member.carbon:[[@LINE+1]]: alias M cannot be used as a name qualifier
fn M.F() {}
fn Main() -> i32 {
+1 -1
View File
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_self_alias.carbon:[[@LINE+1]]: 'a' is not usable until after it has been completely declared
// CHECK:STDERR: COMPILATION ERROR: fail_self_alias.carbon:[[@LINE+1]]: 'a' is not usable until after it has been completely declared
alias a = a;
fn Main() -> i32 {
+1 -1
View File
@@ -9,7 +9,7 @@ package ExplorerTest api;
fn F() {}
alias A = F;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_fn_alias_use.carbon:[[@LINE+1]]: alias A cannot be used as a name qualifier
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_fn_alias_use.carbon:[[@LINE+1]]: alias A cannot be used as a name qualifier
fn A.Foo() {}
fn Main() -> i32 {
@@ -10,6 +10,6 @@ fn F() {}
alias A = F;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_fn_alias_use_expr.carbon:[[@LINE+1]]: member access, unexpected fn () -> () in A.x
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_fn_alias_use_expr.carbon:[[@LINE+1]]: member access, unexpected fn () -> () in A.x
return A.x;
}
@@ -10,6 +10,6 @@ interface Foo {}
alias A = Foo;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_interface_alias_use.carbon:[[@LINE+1]]: member access, bar not in interface Foo
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_interface_alias_use.carbon:[[@LINE+1]]: member access, bar not in interface Foo
return A.bar;
}
@@ -10,6 +10,6 @@ namespace Foo;
alias A = Foo;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/alias/fail_wrong_namepsace_alias_use.carbon:[[@LINE+1]]: expected `.member_name` after name of namespace Foo
// CHECK:STDERR: COMPILATION ERROR: fail_wrong_namepsace_alias_use.carbon:[[@LINE+1]]: expected `.member_name` after name of namespace Foo
return A;
}
+1 -1
View File
@@ -8,6 +8,6 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: [i32; 2] = (0, 1);
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/array/fail_index.carbon:[[@LINE+1]]: index 2 out of range in (0, 1)
// CHECK:STDERR: RUNTIME ERROR: fail_index.carbon:[[@LINE+1]]: index 2 out of range in (0, 1)
return x[2];
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/array/fail_negative_size.carbon:[[@LINE+1]]: Array size cannot be negative
// CHECK:STDERR: COMPILATION ERROR: fail_negative_size.carbon:[[@LINE+1]]: Array size cannot be negative
var x: [i32; -1] = ();
return x[0];
}
@@ -8,7 +8,7 @@ package ExplorerTest impl;
fn Main() -> i32 {
var my_array : [i32; 1];
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/array/fail_print_uninitalized_array_element.carbon:[[@LINE+1]]: Printing uninitialized value
// CHECK:STDERR: RUNTIME ERROR: fail_print_uninitalized_array_element.carbon:[[@LINE+1]]: Printing uninitialized value
Print("{0}", my_array[0]);
return 0;
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/array/fail_size_mismatch.carbon:[[@LINE+1]]: type error in initializer of variable: '(i32, i32, i32)' is not implicitly convertible to '[i32; 2]'
// CHECK:STDERR: COMPILATION ERROR: fail_size_mismatch.carbon:[[@LINE+1]]: type error in initializer of variable: '(i32, i32, i32)' is not implicitly convertible to '[i32; 2]'
var x: [i32; 2] = (0, 1, 2);
return x[0];
}
+1 -1
View File
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/as/fail_destination_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_destination_not_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
return 4 as 7;
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/as/fail_intrinsic_convert_no_args.carbon:[[@LINE+1]]: __intrinsic_implicit_as_convert takes 2 arguments
// CHECK:STDERR: COMPILATION ERROR: fail_intrinsic_convert_no_args.carbon:[[@LINE+1]]: __intrinsic_implicit_as_convert takes 2 arguments
__intrinsic_implicit_as_convert();
return 0;
}
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/as/fail_intrinsic_convert_non_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_intrinsic_convert_non_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
__intrinsic_implicit_as_convert("example", 0);
return 0;
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/as/fail_intrinsic_no_args.carbon:[[@LINE+1]]: __intrinsic_implicit_as takes 1 argument
// CHECK:STDERR: COMPILATION ERROR: fail_intrinsic_no_args.carbon:[[@LINE+1]]: __intrinsic_implicit_as takes 1 argument
__intrinsic_implicit_as();
return 0;
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/as/fail_intrinsic_non_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_intrinsic_non_type.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
__intrinsic_implicit_as(0);
return 0;
}
+1 -1
View File
@@ -10,7 +10,7 @@ class A { var n: i32; }
fn Main() -> i32 {
var a: A = {.n = 5};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/as/fail_no_conversion.carbon:[[@LINE+2]]: type error in `as`: `class A` is not explicitly convertible to `i32`:
// CHECK:STDERR: COMPILATION ERROR: fail_no_conversion.carbon:[[@LINE+2]]: type error in `as`: `class A` is not explicitly convertible to `i32`:
// CHECK:STDERR: could not find implementation of interface As(T = i32) for class A
return a as i32;
}
+1 -1
View File
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
// CHECK:STDERR: RUNTIME ERROR: explorer/data/prelude.carbon:{{.*}}: "HALLO WELT"
// CHECK:STDERR: RUNTIME ERROR: {{.*}}/explorer/data/prelude.carbon:{{.*}}: "HALLO WELT"
package ExplorerTest api;
+1 -1
View File
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
// CHECK:STDERR: RUNTIME ERROR: explorer/data/prelude.carbon:{{.*}}: "Fail"
// CHECK:STDERR: RUNTIME ERROR: {{.*}}/explorer/data/prelude.carbon:{{.*}}: "Fail"
package ExplorerTest api;
+1 -1
View File
@@ -14,7 +14,7 @@ class ConvertTo(T:! type) {
}
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/assert/fail_intrinsic_bool_type.carbon:[[@LINE+1]]: syntax error, unexpected COMMA
// CHECK:STDERR: SYNTAX ERROR: fail_intrinsic_bool_type.carbon:[[@LINE+1]]: syntax error, unexpected COMMA
__intrinsic_assert(, "unused");
return 0;
}
+1 -1
View File
@@ -14,7 +14,7 @@ class ConvertTo(T:! type) {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assert/fail_intrinsic_no_args.carbon:[[@LINE+1]]: __intrinsic_assert takes 2 arguments
// CHECK:STDERR: COMPILATION ERROR: fail_intrinsic_no_args.carbon:[[@LINE+1]]: __intrinsic_assert takes 2 arguments
__intrinsic_assert();
return 0;
}
+1 -1
View File
@@ -14,7 +14,7 @@ class ConvertTo(T:! type) {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assert/fail_intrinsic_no_convert.carbon:[[@LINE+3]]: type error in __intrinsic_assert argument 0
// CHECK:STDERR: COMPILATION ERROR: fail_intrinsic_no_convert.carbon:[[@LINE+3]]: type error in __intrinsic_assert argument 0
// CHECK:STDERR: expected: bool
// CHECK:STDERR: actual: class ConvertTo(T = bool)
__intrinsic_assert({.v = true} as ConvertTo(bool), {.v = "Pass"} as ConvertTo(String));
+1 -1
View File
@@ -14,7 +14,7 @@ class ConvertTo(T:! type) {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assert/fail_intrinsic_str_type.carbon:[[@LINE+3]]: type error in __intrinsic_assert argument 1
// CHECK:STDERR: COMPILATION ERROR: fail_intrinsic_str_type.carbon:[[@LINE+3]]: type error in __intrinsic_assert argument 1
// CHECK:STDERR: expected: String
// CHECK:STDERR: actual: i32
__intrinsic_assert(true, 1);
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
interface Iface {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/assoc_const/fail_anonymous.carbon:[[@LINE+1]]: syntax error, unexpected UNDERSCORE, expecting identifier or TEMPLATE
// CHECK:STDERR: SYNTAX ERROR: fail_anonymous.carbon:[[@LINE+1]]: syntax error, unexpected UNDERSCORE, expecting identifier or TEMPLATE
let _:! type;
}
+1 -1
View File
@@ -19,7 +19,7 @@ external impl Bad as Iface where .T = Bad {}
fn Main() -> i32 {
F(Good);
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_different_type.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value class Bad) == i32, which is not known to be true
// CHECK:STDERR: COMPILATION ERROR: fail_different_type.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value class Bad) == i32, which is not known to be true
F(Bad);
return 0;
}
+1 -1
View File
@@ -19,7 +19,7 @@ external impl Bad as Iface where .N = 4 {}
fn Main() -> i32 {
F(Good);
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_different_value.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.N) (with value 4) == 5, which is not known to be true
// CHECK:STDERR: COMPILATION ERROR: fail_different_value.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.N) (with value 4) == 5, which is not known to be true
F(Bad);
return 0;
}
+1 -1
View File
@@ -24,7 +24,7 @@ fn G[U:! type where .Self == i32, T:! Iface where .T = U](x: T, y: U) {
// Not OK: would require looking through two levels of `==`.
fn H[V:! type where .Self == i32, W:! Iface where .T == V](x: W, y: V) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_equal_indirectly.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value (W).(Iface.T)) == i32, which is not known to be true
// CHECK:STDERR: COMPILATION ERROR: fail_equal_indirectly.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value (W).(Iface.T)) == i32, which is not known to be true
F(x);
}
@@ -17,7 +17,7 @@ fn G[U:! Iface where .T == i32](x: U) {
}
fn H[V:! Iface](x: V) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_equal_to_dependent_type.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value (V).(Iface.T)) == i32, which is not known to be true
// CHECK:STDERR: COMPILATION ERROR: fail_equal_to_dependent_type.carbon:[[@LINE+1]]: constraint requires that (T).(Iface.T) (with value (V).(Iface.T)) == i32, which is not known to be true
F(x);
}
@@ -16,7 +16,7 @@ interface Z {
// We reject this even though it is the responsibility of the `impl as Z` to
// provide a type `N` such that `i32 is X(N)`. We might want to treat this as
// an implied constraint and allow this in the future.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_implied_constraints.carbon:[[@LINE+1]]: could not find implementation of interface X(T = N) for i32
// CHECK:STDERR: COMPILATION ERROR: fail_implied_constraints.carbon:[[@LINE+1]]: could not find implementation of interface X(T = N) for i32
let N:! Y(.Self) where .M = i32;
}
@@ -12,7 +12,7 @@ interface HasThreeTypes {
let C:! type;
}
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_incomplete_impl_1.carbon:[[@LINE+1]]: implementation doesn't provide a concrete value for interface HasThreeTypes.B
// CHECK:STDERR: COMPILATION ERROR: fail_incomplete_impl_1.carbon:[[@LINE+1]]: implementation doesn't provide a concrete value for interface HasThreeTypes.B
external impl i32 as HasThreeTypes where .A = i32 and .C = i32 {}
fn Main() -> i32 { return 0; }
@@ -12,7 +12,7 @@ interface HasThreeTypes {
let C:! type;
}
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_incomplete_impl_2.carbon:[[@LINE+1]]: implementation doesn't provide a concrete value for interface HasThreeTypes.C
// CHECK:STDERR: COMPILATION ERROR: fail_incomplete_impl_2.carbon:[[@LINE+1]]: implementation doesn't provide a concrete value for interface HasThreeTypes.C
external impl i32 as HasThreeTypes where .A = i32 and .B = .C {}
fn Main() -> i32 { return 0; }
+1 -1
View File
@@ -21,7 +21,7 @@ fn F2[U:! A where .T == i32](x: i32) -> U.T {
}
fn F3[T:! A where .T == i32, U:! A where .T == i32](x: T.T) -> U.T {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_indirectly_equal.carbon:[[@LINE+1]]: type error in return value: '(T).(A.T)' is not implicitly convertible to '(U).(A.T)'
// CHECK:STDERR: COMPILATION ERROR: fail_indirectly_equal.carbon:[[@LINE+1]]: type error in return value: '(T).(A.T)' is not implicitly convertible to '(U).(A.T)'
return x;
}
@@ -20,7 +20,7 @@ fn F[Scalar:! type, V:! Vector where .Dim == 3](p: Point(Scalar, V.Dim), v: V) {
fn G[Scalar:! type](p: Point(Scalar, 3)) {}
fn H[V:! Vector where .Dim == 3](v: V) {
var p: Point(i32, V.Dim) = {};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_match_in_deduction.carbon:[[@LINE+1]]: mismatch in non-deduced values, `(V).(Vector.Dim)` != `3`
// CHECK:STDERR: COMPILATION ERROR: fail_match_in_deduction.carbon:[[@LINE+1]]: mismatch in non-deduced values, `(V).(Vector.Dim)` != `3`
G(p);
}
+1 -1
View File
@@ -16,7 +16,7 @@ fn A[T:! Container where .Element == i32](x: T) -> T.Element {
}
fn B[T:! Container](x: T) -> T.Element {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_missing_equal.carbon:[[@LINE+1]]: constraint requires that (T).(Container.Element) (with value (T).(Container.Element)) == i32, which is not known to be true
// CHECK:STDERR: COMPILATION ERROR: fail_missing_equal.carbon:[[@LINE+1]]: constraint requires that (T).(Container.Element) (with value (T).(Container.Element)) == i32, which is not known to be true
return A(x);
}
+1 -1
View File
@@ -16,7 +16,7 @@ fn A[T:! Container where .Element = i32](x: T) -> T.Element {
}
fn B[T:! Container](x: T) -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_missing_rewrite.carbon:[[@LINE+1]]: constraint requires that (T).(Container.Element) (with value (T).(Container.Element)) == i32, which is not known to be true
// CHECK:STDERR: COMPILATION ERROR: fail_missing_rewrite.carbon:[[@LINE+1]]: constraint requires that (T).(Container.Element) (with value (T).(Container.Element)) == i32, which is not known to be true
return A(x);
}
@@ -14,7 +14,7 @@ interface HasThreeTypes {
}
fn F[T:! type](x: (T, T, T));
fn G[X:! HasThreeTypes where .A == .B and .B == .C and .C == .A](x: X) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_multiple_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! type:
// CHECK:STDERR: COMPILATION ERROR: fail_multiple_deduction.carbon:[[@LINE+3]]: deduced multiple different values for T:! type:
// CHECK:STDERR: (X).(HasThreeTypes.A)
// CHECK:STDERR: (X).(HasThreeTypes.B)
F(x.Make());
@@ -10,7 +10,7 @@ interface HasType {
let T:! type;
}
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_overspecified_impl.carbon:[[@LINE+3]]: multiple different rewrites for `(i32).(HasType.T)`:
// CHECK:STDERR: COMPILATION ERROR: fail_overspecified_impl.carbon:[[@LINE+3]]: multiple different rewrites for `(i32).(HasType.T)`:
// CHECK:STDERR: i32
// CHECK:STDERR: {.a: i32}
external impl i32 as HasType where .T = i32 and .T = {.a: i32} {}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
interface Iface {
let T:! type;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_redefined.carbon:[[@LINE+1]]: Duplicate name `T` also found at explorer/testdata/assoc_const/fail_redefined.carbon:[[@LINE-1]]
// CHECK:STDERR: COMPILATION ERROR: fail_redefined.carbon:[[@LINE+1]]: Duplicate name `T` also found at fail_redefined.carbon:[[@LINE-1]]
let T:! type;
}
@@ -10,7 +10,7 @@ interface HasType {
let T:! type;
}
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_rewrite_creates_infinite_type.carbon:[[@LINE+1]]: rewrite of (H).(HasType.T) applies within its own resolved expansion of (H).(HasType.T)*
// CHECK:STDERR: COMPILATION ERROR: fail_rewrite_creates_infinite_type.carbon:[[@LINE+1]]: rewrite of (H).(HasType.T) applies within its own resolved expansion of (H).(HasType.T)*
fn F[H:! HasType where .T = .T*]() {}
fn Main() -> i32 {
+1 -1
View File
@@ -30,7 +30,7 @@ fn F[
.T6 = .T7 and
.T7 = .T8 and
.T8 = .T9 and
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_rewrite_cycle.carbon:[[@LINE+1]]: rewrite of (M).(ManyTypes.T4) applies within its own resolved expansion of (M).(ManyTypes.T4)
// CHECK:STDERR: COMPILATION ERROR: fail_rewrite_cycle.carbon:[[@LINE+1]]: rewrite of (M).(ManyTypes.T4) applies within its own resolved expansion of (M).(ManyTypes.T4)
.T9 = .T0]() {}
fn Main() -> i32 {
@@ -11,7 +11,7 @@ interface HasTypeAndValue {
let V:! T;
}
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_rewrite_depends_on_later_rewrite.carbon:[[@LINE+1]]: type error in rewrite constraint: 'i32' is not implicitly convertible to '(X).(HasTypeAndValue.T)'
// CHECK:STDERR: COMPILATION ERROR: fail_rewrite_depends_on_later_rewrite.carbon:[[@LINE+1]]: type error in rewrite constraint: 'i32' is not implicitly convertible to '(X).(HasTypeAndValue.T)'
fn F(X:! HasTypeAndValue where .V = 5 and .T = i32) -> i32 { return X.V; }
impl i32 as HasTypeAndValue where .T = i32 and .V = 5 {}
@@ -13,7 +13,7 @@ interface TwoTypes {
// Attempting to fully resolve the replacement for `.T` would never create a
// situation where `.T`'s expansion involves `.T`. Ensure we catch this anyway.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_simple_rewrite_cycle_1.carbon:[[@LINE+1]]: rewrite of (X).(TwoTypes.U) applies within its own resolved expansion of (X).(TwoTypes.U)*
// CHECK:STDERR: COMPILATION ERROR: fail_simple_rewrite_cycle_1.carbon:[[@LINE+1]]: rewrite of (X).(TwoTypes.U) applies within its own resolved expansion of (X).(TwoTypes.U)*
fn F[X:! TwoTypes where .T = .U and .U = .U*]() {}
fn Main() -> i32 {
@@ -13,7 +13,7 @@ interface TwoTypes {
// Attempting to fully resolve the replacement for `.T` would never create a
// situation where `.T`'s expansion involves `.T`. Ensure we catch this anyway.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_simple_rewrite_cycle_2.carbon:[[@LINE+1]]: rewrite of (X).(TwoTypes.U) applies within its own resolved expansion of (X).(TwoTypes.U)*
// CHECK:STDERR: COMPILATION ERROR: fail_simple_rewrite_cycle_2.carbon:[[@LINE+1]]: rewrite of (X).(TwoTypes.U) applies within its own resolved expansion of (X).(TwoTypes.U)*
fn F[X:! TwoTypes where .U = .U* and .T = .U]() {}
fn Main() -> i32 {
+1 -1
View File
@@ -11,7 +11,7 @@ interface Iface { let N:! i32; }
fn PickType(N: i32) -> type { return i32; }
fn F[T:! Iface](x: T) -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_unknown_value.carbon:[[@LINE+1]]: value of associated constant (T).(Iface.N) is not known
// CHECK:STDERR: COMPILATION ERROR: fail_unknown_value.carbon:[[@LINE+1]]: value of associated constant (T).(Iface.N) is not known
var x: PickType(T.N) = 0;
return x;
}
@@ -12,7 +12,7 @@ fn PickType(N: i32) -> type { return i32; }
fn F[T:! Iface where .N == 5](x: T) -> i32 {
// TODO: This should be valid: the value of T.N is known to be 5 here.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/assoc_const/fail_unknown_value_specified_in_constraint.carbon:[[@LINE+1]]: value of associated constant (T).(Iface.N) is not known
// CHECK:STDERR: COMPILATION ERROR: fail_unknown_value_specified_in_constraint.carbon:[[@LINE+1]]: value of associated constant (T).(Iface.N) is not known
var x: PickType(T.N) = 0;
return x;
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
// TODO: The error here should be that we aren't allowed to refer to 'a' yet.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/auto/fail_use_in_init.carbon:[[@LINE+1]]: could not resolve 'a'
// CHECK:STDERR: COMPILATION ERROR: fail_use_in_init.carbon:[[@LINE+1]]: could not resolve 'a'
var a: auto = a;
return 0;
}
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_alternative_not_type.carbon:[[@LINE+1]]: type error in type expression: '(i32,)' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_alternative_not_type.carbon:[[@LINE+1]]: type error in type expression: '(i32,)' is not implicitly convertible to 'type'
choice C { X(42) }
fn Main() -> i32 {
@@ -7,7 +7,7 @@
package ExplorerTest api;
choice Ch {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_alternative_uses_choice.carbon:[[@LINE+1]]: 'Ch' is not usable until after it has been completely declared
// CHECK:STDERR: COMPILATION ERROR: fail_alternative_uses_choice.carbon:[[@LINE+1]]: 'Ch' is not usable until after it has been completely declared
Opt(Ch)
}
@@ -10,7 +10,7 @@ fn F() {}
fn G() {}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_assign_to_function.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `F`
// CHECK:STDERR: COMPILATION ERROR: fail_assign_to_function.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `F`
F = G;
return 0;
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_assign_to_rval.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `1`
// CHECK:STDERR: COMPILATION ERROR: fail_assign_to_rval.carbon:[[@LINE+1]]: Only a reference expression can be assigned to, but got `1`
1 = 0;
return 0;
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
{
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_block.carbon:[[@LINE+1]]: syntax error, unexpected RETURN, expecting PERIOD or RIGHT_CURLY_BRACE
// CHECK:STDERR: SYNTAX ERROR: fail_block.carbon:[[@LINE+1]]: syntax error, unexpected RETURN, expecting PERIOD or RIGHT_CURLY_BRACE
return 0;
}
}
@@ -13,7 +13,7 @@ choice Ints {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
// CHECK:STDERR: COMPILATION ERROR: fail_choice_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
match (Ints.None()) {
case Ints.None => { return 0; }
default => { return 1; }
@@ -15,7 +15,7 @@ choice Ints {
fn Main() -> i32 {
match (Ints.None) {
case Ints.None() => { return 0; }
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: COMPILATION ERROR: fail_choice_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: expected: choice Ints
// CHECK:STDERR: actual: fn () -> choice Ints
default => { return 1; }
@@ -14,7 +14,7 @@ choice Ints {
fn Main() -> i32 {
match (Ints.None) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_pattern_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
// CHECK:STDERR: COMPILATION ERROR: fail_choice_pattern_extra_parens.carbon:[[@LINE+1]]: alternative `choice Ints.None` does not expect an argument list
case Ints.None() => { return 0; }
default => { return 1; }
}
@@ -15,7 +15,7 @@ choice Ints {
fn Main() -> i32 {
match (Ints.None()) {
case Ints.None => { return 0; }
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_choice_pattern_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: COMPILATION ERROR: fail_choice_pattern_no_parens.carbon:[[@LINE+3]]: type error in `match` pattern type
// CHECK:STDERR: expected: fn () -> choice Ints
// CHECK:STDERR: actual: choice Ints
default => { return 1; }
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn CompareBools(a: bool, b: bool) -> bool {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_compare_precedence.carbon:[[@LINE+1]]: syntax error, unexpected EQUAL_EQUAL, expecting SEMICOLON
// CHECK:STDERR: SYNTAX ERROR: fail_compare_precedence.carbon:[[@LINE+1]]: syntax error, unexpected EQUAL_EQUAL, expecting SEMICOLON
return not a == b;
}
+1 -1
View File
@@ -4,5 +4,5 @@
//
// AUTOUPDATE
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_invalid_char.carbon:[[@LINE+1]]: invalid character '\xEF' in source file.
// CHECK:STDERR: SYNTAX ERROR: fail_invalid_char.carbon:[[@LINE+1]]: invalid character '\xEF' in source file.
�
+1 -1
View File
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_invalid_integer.carbon:[[@LINE+1]]: Invalid integer literal: 11111111111111111111111111
// CHECK:STDERR: SYNTAX ERROR: fail_invalid_integer.carbon:[[@LINE+1]]: Invalid integer literal: 11111111111111111111111111
return 11111111111111111111111111;
}
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_invalid_integer_type.carbon:[[@LINE+1]]: Invalid type literal: i11111111111111111111111111
// CHECK:STDERR: SYNTAX ERROR: fail_invalid_integer_type.carbon:[[@LINE+1]]: Invalid type literal: i11111111111111111111111111
var x: i11111111111111111111111111 = 1;
return 0;
}
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/basic_syntax/fail_unimplemented_example.carbon:[[@LINE+1]]: Unimplemented
// CHECK:STDERR: COMPILATION ERROR: fail_unimplemented_example.carbon:[[@LINE+1]]: Unimplemented
return 1 __unimplemented_example_infix 2;
}
@@ -7,6 +7,6 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_unknown_intrinsic.carbon:[[@LINE+1]]: Unknown intrinsic 'nonexistent'
// CHECK:STDERR: SYNTAX ERROR: fail_unknown_intrinsic.carbon:[[@LINE+1]]: Unknown intrinsic 'nonexistent'
return __intrinsic_nonexistent();
}
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/basic_syntax/fail_unsupported_integer_type.carbon:[[@LINE+1]]: Only i32 is supported for now: i64
// CHECK:STDERR: SYNTAX ERROR: fail_unsupported_integer_type.carbon:[[@LINE+1]]: Only i32 is supported for now: i64
var x: i64 = 1;
return 0;
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
choice C {
X,
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/choice/fail_recursive_use.carbon:[[@LINE+1]]: 'C' is not usable until after it has been completely declared
// CHECK:STDERR: COMPILATION ERROR: fail_recursive_use.carbon:[[@LINE+1]]: 'C' is not usable until after it has been completely declared
Y(if C.X then i32 else i32)
}
@@ -12,7 +12,7 @@ base class C {
class D extends C {
abstract fn Foo[self:Self]() -> i32 {
return 1;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_abstract_method_not_supported.carbon:[[@LINE+1]]: Error declaring `Foo`: `abstract` methods are not yet supported.
// CHECK:STDERR: COMPILATION ERROR: fail_abstract_method_not_supported.carbon:[[@LINE+1]]: Error declaring `Foo`: `abstract` methods are not yet supported.
}
}
@@ -8,7 +8,7 @@ package ExplorerTest api;
class A {
fn F[self: Self]() -> type {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_call_method_before_typecheck.carbon:[[@LINE+1]]: attempt to call function `F` that has not been fully type-checked
// CHECK:STDERR: COMPILATION ERROR: fail_call_method_before_typecheck.carbon:[[@LINE+1]]: attempt to call function `F` that has not been fully type-checked
var a: ({} as A).F() = 0;
return i32;
}
+1 -1
View File
@@ -12,6 +12,6 @@ class A {
fn Main() -> i32 {
var a: A = {};
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/class/fail_call_undefined_method.carbon:[[@LINE+1]]: attempt to call function `F` that has not been defined
// CHECK:STDERR: RUNTIME ERROR: fail_call_undefined_method.carbon:[[@LINE+1]]: attempt to call function `F` that has not been defined
return a.F();
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
// Error: Can't use keyword `Self` as the name of a class.
// CHECK:STDERR: SYNTAX ERROR: explorer/testdata/class/fail_class_named_self.carbon:[[@LINE+1]]: syntax error, unexpected SELF, expecting identifier or LEFT_PARENTHESIS
// CHECK:STDERR: SYNTAX ERROR: fail_class_named_self.carbon:[[@LINE+1]]: syntax error, unexpected SELF, expecting identifier or LEFT_PARENTHESIS
class Self {
var x: i32;
var y: i32;
+1 -1
View File
@@ -15,7 +15,7 @@ class B extends A {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_direct_base_class_init.carbon:[[@LINE+1]]: type error in initializer of variable: '{.a: i32, .b: i32}' is not implicitly convertible to 'class B'
// CHECK:STDERR: COMPILATION ERROR: fail_direct_base_class_init.carbon:[[@LINE+1]]: type error in initializer of variable: '{.a: i32, .b: i32}' is not implicitly convertible to 'class B'
var b: B = {.a=0, .b=1};
return 0;
}
+1 -1
View File
@@ -12,7 +12,7 @@ class C {
class D extends C {
fn G() {}
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_extends_final_class.carbon:[[@LINE+1]]: Base class `C` is `final` and cannot be inherited. Add the `base` or `abstract` class prefix to `C` to allow it to be inherited
// CHECK:STDERR: COMPILATION ERROR: fail_extends_final_class.carbon:[[@LINE+1]]: Base class `C` is `final` and cannot be inherited. Add the `base` or `abstract` class prefix to `C` to allow it to be inherited
}
fn Main() -> i32 {
+1 -1
View File
@@ -6,7 +6,7 @@
package ExplorerTest api;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_extends_non_class.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
// CHECK:STDERR: COMPILATION ERROR: fail_extends_non_class.carbon:[[@LINE+1]]: type error in type expression: 'i32' is not implicitly convertible to 'type'
class C extends 3 {
var x: i32;
var y: i32;
+1 -1
View File
@@ -13,6 +13,6 @@ class Point {
fn Main() -> i32 {
var p: Point = {.x = 1, .y = 2};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_field_access_mismatch.carbon:[[@LINE+1]]: class Point does not have a field named z
// CHECK:STDERR: COMPILATION ERROR: fail_field_access_mismatch.carbon:[[@LINE+1]]: class Point does not have a field named z
return p.z - 1;
}
@@ -17,6 +17,6 @@ class Point3D extends Point {
fn Main() -> i32 {
var p: Point3D = {.base={.x = 1, .y = 2}, .z = 3};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_field_access_mismatch_base.carbon:[[@LINE+1]]: class Point3D does not have a field named a
// CHECK:STDERR: COMPILATION ERROR: fail_field_access_mismatch_base.carbon:[[@LINE+1]]: class Point3D does not have a field named a
return p.a;
}
@@ -17,7 +17,7 @@ class Point3D extends Point {
fn Main() -> i32 {
var p: Point3D = {.base={.x = 1, .y = 2}, .z = 3};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_field_assign_mismatch_base.carbon:[[@LINE+1]]: class Point3D does not have a field named a
// CHECK:STDERR: COMPILATION ERROR: fail_field_assign_mismatch_base.carbon:[[@LINE+1]]: class Point3D does not have a field named a
p.a = 0;
return 0;
}
+1 -1
View File
@@ -12,7 +12,7 @@ class Point {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_field_mismatch.carbon:[[@LINE+1]]: type error in initializer of variable: '{.x: i32, .z: i32}' is not implicitly convertible to 'class Point'
// CHECK:STDERR: COMPILATION ERROR: fail_field_mismatch.carbon:[[@LINE+1]]: type error in initializer of variable: '{.x: i32, .z: i32}' is not implicitly convertible to 'class Point'
var p: Point = {.x = 1, .z = 2};
return p.x - 1;
}
+1 -1
View File
@@ -12,7 +12,7 @@ class Point {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_field_missing.carbon:[[@LINE+1]]: type error in initializer of variable: '{.x: i32}' is not implicitly convertible to 'class Point'
// CHECK:STDERR: COMPILATION ERROR: fail_field_missing.carbon:[[@LINE+1]]: type error in initializer of variable: '{.x: i32}' is not implicitly convertible to 'class Point'
var p: Point = {.x = 1};
return p.x - 1;
}
@@ -12,7 +12,7 @@ base class C {
class D extends C {
impl fn Foo[self:Self]() -> i32 {
return 1;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_impl_method_not_existing.carbon:[[@LINE+1]]: Error declaring `Foo`: cannot override a method that is not declared `abstract` or `virtual` in base class.
// CHECK:STDERR: COMPILATION ERROR: fail_impl_method_not_existing.carbon:[[@LINE+1]]: Error declaring `Foo`: cannot override a method that is not declared `abstract` or `virtual` in base class.
}
}
@@ -15,7 +15,7 @@ base class C {
class D extends C {
impl fn Foo[self:Self]() -> i32 {
return 1;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_impl_method_not_virtual.carbon:[[@LINE+1]]: Error declaring `Foo`: cannot override a method that is not declared `abstract` or `virtual` in base class.
// CHECK:STDERR: COMPILATION ERROR: fail_impl_method_not_virtual.carbon:[[@LINE+1]]: Error declaring `Foo`: cannot override a method that is not declared `abstract` or `virtual` in base class.
}
}
@@ -15,7 +15,7 @@ abstract class C {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_instantiate_abstract_class_constructor.carbon:[[@LINE+1]]: Cannot instantiate abstract class C
// CHECK:STDERR: COMPILATION ERROR: fail_instantiate_abstract_class_constructor.carbon:[[@LINE+1]]: Cannot instantiate abstract class C
var c: C = C.Create();
return 0;
}
@@ -11,7 +11,7 @@ abstract class C {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_instantiate_abstract_class_empty.carbon:[[@LINE+1]]: Cannot instantiate abstract class C
// CHECK:STDERR: COMPILATION ERROR: fail_instantiate_abstract_class_empty.carbon:[[@LINE+1]]: Cannot instantiate abstract class C
var c: C;
return 0;
}
@@ -11,7 +11,7 @@ abstract class C {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_instantiate_abstract_class_struct.carbon:[[@LINE+1]]: Cannot instantiate abstract class C
// CHECK:STDERR: COMPILATION ERROR: fail_instantiate_abstract_class_struct.carbon:[[@LINE+1]]: Cannot instantiate abstract class C
var c: C = { .a = 1 };
return 0;
}
+1 -1
View File
@@ -14,7 +14,7 @@ class D {
fn Main() -> i32 {
var d: D = {};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_invalid_subtyping.carbon:[[@LINE+1]]: type error in initializer of variable: 'class D*' is not implicitly convertible to 'class C*'
// CHECK:STDERR: COMPILATION ERROR: fail_invalid_subtyping.carbon:[[@LINE+1]]: type error in initializer of variable: 'class D*' is not implicitly convertible to 'class C*'
var c: C* = &d;
return 0;
}
@@ -10,7 +10,7 @@ class C {
fn PickType() -> type { return i32; }
// This is invalid even though `PickType` is defined earlier, because
// checking of member bodies is deferred until after the class is completed.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_member_call_before_typecheck.carbon:[[@LINE+1]]: attempt to call function `PickType` that has not been fully type-checked
// CHECK:STDERR: COMPILATION ERROR: fail_member_call_before_typecheck.carbon:[[@LINE+1]]: attempt to call function `PickType` that has not been fully type-checked
fn GetZero() -> PickType() { return 0; }
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
class C {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_member_of_self.carbon:[[@LINE+1]]: incomplete type `class C` used in type of variable
// CHECK:STDERR: COMPILATION ERROR: fail_member_of_self.carbon:[[@LINE+1]]: incomplete type `class C` used in type of variable
var m: Self;
}
+1 -1
View File
@@ -15,7 +15,7 @@ fn H[T:! type](x: T) {}
fn Main() -> i32 {
H(C.F);
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_method_deduced.carbon:[[@LINE+1]]: member name G can only be used in a member access or alias
// CHECK:STDERR: COMPILATION ERROR: fail_method_deduced.carbon:[[@LINE+1]]: member name G can only be used in a member access or alias
H(C.G);
return 0;
}
+1 -1
View File
@@ -20,6 +20,6 @@ class Point {
}
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_method_from_class.carbon:[[@LINE+1]]: in call `Point.GetX()`, expected callee to be a function, found `member name GetX`
// CHECK:STDERR: COMPILATION ERROR: fail_method_from_class.carbon:[[@LINE+1]]: in call `Point.GetX()`, expected callee to be a function, found `member name GetX`
return Point.GetX();
}
+1 -1
View File
@@ -13,7 +13,7 @@ class C {
fn Main() -> i32 {
var f: auto = C.F;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_method_in_var.carbon:[[@LINE+1]]: member name G can only be used in a member access or alias
// CHECK:STDERR: COMPILATION ERROR: fail_method_in_var.carbon:[[@LINE+1]]: member name G can only be used in a member access or alias
var g: auto = C.G;
return 0;
@@ -11,7 +11,7 @@ base class A {
}
class B extends A {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_override_virtual_with_non_virtual.carbon:[[@LINE+1]]: Error declaring `Foo`: method is declared virtual in base class, use `impl` to override it.
// CHECK:STDERR: COMPILATION ERROR: fail_override_virtual_with_non_virtual.carbon:[[@LINE+1]]: Error declaring `Foo`: method is declared virtual in base class, use `impl` to override it.
fn Foo[self: Self]() {}
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
class Point {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_qualified_method.carbon:[[@LINE+1]]: qualified declaration names are not permitted in this context
// CHECK:STDERR: COMPILATION ERROR: fail_qualified_method.carbon:[[@LINE+1]]: qualified declaration names are not permitted in this context
fn Point.F[self: Self]() {}
}
@@ -11,7 +11,7 @@ base class C {
}
class D extends C {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_redeclare_virtual_method.carbon:[[@LINE+1]]: Error declaring `Foo`: method is declared virtual in base class, use `impl` to override it.
// CHECK:STDERR: COMPILATION ERROR: fail_redeclare_virtual_method.carbon:[[@LINE+1]]: Error declaring `Foo`: method is declared virtual in base class, use `impl` to override it.
virtual fn Foo[self:Self]() {}
}
+1 -1
View File
@@ -12,7 +12,7 @@ class C {
}
fn ReturnF() -> auto { return C.F; }
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_return_method.carbon:[[@LINE+1]]: member name G can only be used in a member access or alias
// CHECK:STDERR: COMPILATION ERROR: fail_return_method.carbon:[[@LINE+1]]: member name G can only be used in a member access or alias
fn ReturnG() -> auto { return C.G; }
fn Main() -> i32 {
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
class C {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_use_before_typecheck.carbon:[[@LINE+1]]: incomplete type `class C` used in member access
// CHECK:STDERR: COMPILATION ERROR: fail_use_before_typecheck.carbon:[[@LINE+1]]: incomplete type `class C` used in member access
var n: if not C.WrapInStruct() then i32 else {.n: i32};
fn WrapInStruct() -> bool { return true; }
}
+1 -1
View File
@@ -9,7 +9,7 @@ package ExplorerTest api;
class C {
virtual fn Foo() -> i32 {
return 1;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_virtual_class_function.carbon:[[@LINE+1]]: Error declaring `Foo`: class functions cannot be virtual.
// CHECK:STDERR: COMPILATION ERROR: fail_virtual_class_function.carbon:[[@LINE+1]]: Error declaring `Foo`: class functions cannot be virtual.
}
}
+1 -1
View File
@@ -17,6 +17,6 @@ fn Main() -> i32 {
var bp: B* = &b;
var ap: A* = bp;
// Shouldn't look into the vtable for B.
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/class/fail_virtual_method_absent.carbon:[[@LINE+1]]: class A does not have a field named Foo
// CHECK:STDERR: COMPILATION ERROR: fail_virtual_method_absent.carbon:[[@LINE+1]]: class A does not have a field named Foo
return ap->Foo();
}
+1 -1
View File
@@ -7,7 +7,7 @@
package ExplorerTest api;
fn Main() -> i32 {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/comparison/fail_no_impl.carbon:[[@LINE+1]]: i32 is not equality comparable with String (could not find implementation of interface EqWith(U = String) for i32)
// CHECK:STDERR: COMPILATION ERROR: fail_no_impl.carbon:[[@LINE+1]]: i32 is not equality comparable with String (could not find implementation of interface EqWith(U = String) for i32)
Print("different types equal: {0}", if 1 == "1" then 1 else 0);
return 0;
}

Some files were not shown because too many files have changed in this diff Show More