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
Refactor modifier formatting to remove string passing. (#4418)
I'm taking the approach of making DiagnosticBase an API so that we can
pass similar diagnostics as parameters. An alternative would be to do
the function_ref approach we've done elsewhere, but these felt more
boilerplate to me.
Note I'm also modifying messages here. Let me know if you'd like
different changes and/or just keeping current formatting (keeping
current formatting would also allow removing some of the templating I've
added, but it felt helpful putting explicit tokens where possible). But
also, things like "`protected` not allowed on `interface` declaration at
file scope" were part of the phrasing issue, I think.
---------
Co-authored-by: Richard Smith <[email protected]>
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE-5]]:1: note: containing definition here
@@ -19,7 +19,7 @@ class FinalClass {
19
19
// CHECK:STDERR:
20
20
abstract fn Abstract[self: Self]();
21
21
22
-
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error: `virtual` not allowed on `fn` declaration in a non-abstract non-base `class` definition
22
+
// CHECK:STDERR: fail_method_modifiers.carbon:[[@LINE+7]]:3: error: `virtual` not allowed; requires `abstract` or `base` class scope
Copy file name to clipboardExpand all lines: toolchain/check/testdata/class/fail_modifiers.carbon
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@
17
17
// CHECK:STDERR:
18
18
private private class DuplicatePrivate;
19
19
20
-
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `class` declaration, only definition
20
+
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `abstract` not allowed on `class` forward declaration, only definition
21
21
// CHECK:STDERR: abstract class AbstractDecl;
22
22
// CHECK:STDERR: ^~~~~~~~
23
23
// CHECK:STDERR:
@@ -32,7 +32,7 @@ abstract class AbstractDecl;
32
32
// CHECK:STDERR:
33
33
private protected class TwoAccess;
34
34
35
-
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `base` not allowed on `class` declaration, only definition
35
+
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `base` not allowed on `class` forward declaration, only definition
36
36
// CHECK:STDERR: base class BaseDecl;
37
37
// CHECK:STDERR: ^~~~
38
38
// CHECK:STDERR:
@@ -47,7 +47,7 @@ base class BaseDecl;
47
47
// CHECK:STDERR:
48
48
abstract abstract class TwoAbstract { }
49
49
50
-
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: error: `protected` not allowed on `class` declaration at file scope, `protected` is only allowed on class members
50
+
// CHECK:STDERR: fail_modifiers.carbon:[[@LINE+15]]:1: error: `protected` not allowed; requires classscope
51
51
// CHECK:STDERR: protected virtual base class Virtual {}
0 commit comments