diff options
| author | 2026-10-14 09:33:03 +0000 | |
|---|---|---|
| committer | 2026-10-14 09:33:03 +0000 | |
| commit | ebaa15f02dd0e5aa358ea2e527ae4557e40b4e9c (patch) | |
| tree | 9f53ccfed1eedd90df2747bdfd0e9ea907caee95 /tests/errors | |
| parent | todo: record the reverted unchecked trial and what it showed (diff) | |
constants inside structs, and typo suggestions for fields and static members
const NAME = e; inside a struct body declares a compile-time constant named
Struct.NAME, reached as Struct.NAME or by bare name in the struct's methods.
A misspelled field or Struct.name member now ends its error with
'; did you mean 'name'?' on the member word, which the language server
turns into a quick fix.
Diffstat (limited to 'tests/errors')
| -rw-r--r-- | tests/errors/static_const_typo.zc | 5 | ||||
| -rw-r--r-- | tests/errors/static_typo.zc | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/errors/static_const_typo.zc b/tests/errors/static_const_typo.zc new file mode 100644 index 0000000..c7f2b7b --- /dev/null +++ b/tests/errors/static_const_typo.zc @@ -0,0 +1,5 @@ +namespace; + +// expect: MAXX: is not a static function of this struct; did you mean 'MAX'? +struct Text { const MAX = 24; int len; }; +fn main() { return Text.MAXX; } diff --git a/tests/errors/static_typo.zc b/tests/errors/static_typo.zc new file mode 100644 index 0000000..97f6513 --- /dev/null +++ b/tests/errors/static_typo.zc @@ -0,0 +1,5 @@ +namespace; + +// expect: itao: is not a static function of this struct; did you mean 'itoa'? +struct Text { int len; static int itoa(int n) { return n; } }; +fn main() { return Text.itao(1); } |
