aboutsummaryrefslogtreecommitdiff
path: root/tests/typeerrors
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 09:33:03 +0000
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 09:33:03 +0000
commitebaa15f02dd0e5aa358ea2e527ae4557e40b4e9c (patch)
tree9f53ccfed1eedd90df2747bdfd0e9ea907caee95 /tests/typeerrors
parenttodo: 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/typeerrors')
-rw-r--r--tests/typeerrors/field_typo.zc5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/typeerrors/field_typo.zc b/tests/typeerrors/field_typo.zc
new file mode 100644
index 0000000..aa64209
--- /dev/null
+++ b/tests/typeerrors/field_typo.zc
@@ -0,0 +1,5 @@
+namespace;
+
+// expect: point has no field lenght; did you mean 'length'?
+struct point { int length, width; };
+fn main() { point* p; return p.lenght; }