From ebaa15f02dd0e5aa358ea2e527ae4557e40b4e9c Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 09:33:03 +0000 Subject: 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. --- tests/drivers/hint_fixes_test.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/drivers') diff --git a/tests/drivers/hint_fixes_test.js b/tests/drivers/hint_fixes_test.js index 20d3dd1..a388911 100644 --- a/tests/drivers/hint_fixes_test.js +++ b/tests/drivers/hint_fixes_test.js @@ -76,5 +76,9 @@ fixes('a misspelled local function is corrected', 'int count_items() { return 1; 'int count_items() { return 1; }\nfn main() {\n\treturn count_items();\n}\n', 'change to `count_items`'); fixes('a qualified name from a file library adds its include', 'include rt;\nfn main() {\n\treturn actor.vector();\n}\n', 'actor', 0, 'include rt;\ninclude actor;\nfn main() {\n\treturn actor.vector();\n}\n', 'include actor'); +fixes('a misspelled field is corrected', 'include rt;\nstruct point { int length, width; }\nfn main() {\n\tpoint* p = rt.new(point);\n\treturn p.lenght;\n}\n', 'lenght', 0, + 'include rt;\nstruct point { int length, width; }\nfn main() {\n\tpoint* p = rt.new(point);\n\treturn p.length;\n}\n', 'change to `length`'); +fixes('a misspelled static function of a library group is corrected', 'include rt;\ninclude std;\nfn main() {\n\treturn std.Text.itao(5, 0);\n}\n', 'itao', 0, + 'include rt;\ninclude std;\nfn main() {\n\treturn std.Text.itoa(5, 0);\n}\n', 'change to `itoa`'); console.log(ok + ' hint fix checks passed, ' + bad + ' failed'); process.exit(bad ? 1 : 0); -- cgit v1.2.3