You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dropping this in with basic.carbon as an aspirational way to encourage
more tests there.
This currently crashes because `CollectCandidateImplsForQuery` tries
building a type structure which cannot contain `ErrorInst`.
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
7
-
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
8
6
//
9
7
// AUTOUPDATE
10
8
// TIP: To test this file alone, run:
11
9
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/basic.carbon
12
10
// TIP: To dump output, run:
13
11
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/basic.carbon
14
12
13
+
// --- basic.carbon
14
+
15
+
library "[[@TEST_NAME]]";
16
+
15
17
interfaceSimple {
16
18
fnF();
17
19
}
18
20
19
21
class C {}
20
22
23
+
//@dump-sem-ir-begin
21
24
impl C asSimple {
22
25
fnF() {}
23
26
}
27
+
//@dump-sem-ir-end
28
+
29
+
// --- fail_invalid_impl.carbon
30
+
31
+
library "[[@TEST_NAME]]";
32
+
33
+
interfaceI {
34
+
fn Op[self: Self]();
35
+
}
36
+
37
+
class C {}
38
+
39
+
// This produces an invalid impl.
40
+
// CHECK:STDERR: fail_invalid_impl.carbon:[[@LINE+4]]:6: error: name `Unknown` not found [NameNotFound]
41
+
// CHECK:STDERR: impl Unknown as I {
42
+
// CHECK:STDERR: ^~~~~~~
43
+
// CHECK:STDERR:
44
+
impl Unknown asI {
45
+
fn Op[self: Self]() {}
46
+
}
47
+
48
+
// --- fail_import_invalid_impl.carbon
49
+
50
+
library "[[@TEST_NAME]]";
51
+
importlibrary"invalid_impl";
52
+
53
+
fnF() {
54
+
// This impl doesn't exist, but it still tests that we can ignore the
55
+
// `impl Unknown as I` on import.
56
+
// CHECK:STDERR: fail_import_invalid_impl.carbon:[[@LINE+4]]:3: error: cannot access member of interface `I` in type `type` that does not implement that interface [MissingImplInMemberAccess]
57
+
// CHECK:STDERR: C.(I.Op)();
58
+
// CHECK:STDERR: ^~~~~~~~
59
+
// CHECK:STDERR:
60
+
C.(I.Op)();
61
+
}
24
62
25
63
// CHECK:STDOUT: --- basic.carbon
26
64
// CHECK:STDOUT:
27
65
// CHECK:STDOUT: constants {
28
66
// CHECK:STDOUT: %Simple.type: type = facet_type <@Simple> [concrete]
0 commit comments