forked from carbon-language/carbon-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle impl with bad interface on import (carbon-language#5051)
Co-authored-by: Josh L <josh11b@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
toolchain/check/testdata/impl/no_prelude/import_impl_with_no_interface.carbon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM | ||
// Exceptions. See /LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// EXTRA-ARGS: --no-dump-sem-ir | ||
// | ||
// AUTOUPDATE | ||
// TIP: To test this file alone, run: | ||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/import_impl_with_no_interface.carbon | ||
// TIP: To dump output, run: | ||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/import_impl_with_no_interface.carbon | ||
|
||
// --- fail_lib.carbon | ||
library "[[@TEST_NAME]]"; | ||
|
||
// CHECK:STDERR: fail_lib.carbon:[[@LINE+4]]:18: error: name `Undeclared` not found [NameNotFound] | ||
// CHECK:STDERR: impl {.i: ()} as Undeclared { | ||
// CHECK:STDERR: ^~~~~~~~~~ | ||
// CHECK:STDERR: | ||
impl {.i: ()} as Undeclared { | ||
fn F() {} | ||
} | ||
|
||
interface Instance { | ||
fn G[self: Self](); | ||
} | ||
|
||
impl {.i: ()} as Instance { | ||
fn G[self: Self]() {} | ||
} | ||
|
||
// --- import_instance_success.carbon | ||
library "[[@TEST_NAME]]"; | ||
|
||
import library "lib"; | ||
|
||
fn InstanceCallImport(n: {.i: ()}) { | ||
n.(Instance.G)(); | ||
} |