Temporary restriction that extend base is first in a class to avoid #2994 (#2995)

Closes #2994

---------

Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
josh11b
2023-07-24 18:11:40 +00:00
committed by GitHub
co-authored by Geoff Romer
parent 9edfa9cad3
commit cf2ddc6072
3 changed files with 67 additions and 44 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ base class C {
class E {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: fail_extend_after_var.carbon:[[@LINE+1]]: `extend base:` declaration must not be after `var` or `mix` declarations in a class.
// CHECK:STDERR: COMPILATION ERROR: fail_extend_after_var.carbon:[[@LINE+1]]: `extend base:` declarations after the first declaration in the class are not yet supported
extend base: C;
}
+22
View File
@@ -0,0 +1,22 @@
// 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
//
// AUTOUPDATE
package ExplorerTest api;
class E {
base class C {
}
// This should be allowed, but Explorer forbids it until the problem from
// https://github.com/carbon-language/carbon-lang/issues/2994 can be fixed.
// CHECK:STDERR: COMPILATION ERROR: fail_extend_member_class.carbon:[[@LINE+1]]: `extend base:` declarations after the first declaration in the class are not yet supported
extend base: C;
}
fn Main() -> i32 {
return 0;
}