mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Relax alias restrictions. (#7190)
Implement the alias rules from proposal #5389, wherein an alias is permitted so long as the target has a constant value. While that proposal is not yet accepted, this seems like a reasonable basis for further iteration, and will be useful for the examples we're currently pursuing.
This commit is contained in:
@@ -84,13 +84,13 @@ class B(N:! i32) {
|
||||
|
||||
// TODO: Once we allow this, we should produce an "invalid array bound" error
|
||||
// during monomorphization triggered by the C++ code.
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:11: error: alias initializer must be a name reference [AliasRequiresNameRef]
|
||||
// CHECK:STDERR: alias T = B(-1);
|
||||
// CHECK:STDERR: ^~~~~
|
||||
// CHECK:STDERR:
|
||||
alias T = B(-1);
|
||||
|
||||
inline Cpp '''
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+8]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
|
||||
// CHECK:STDERR: Carbon::T t;
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError]
|
||||
// CHECK:STDERR: 22 | Carbon::T t;
|
||||
// CHECK:STDERR: | ~~~~~~~~^
|
||||
|
||||
Reference in New Issue
Block a user