diff --git a/src/canonicalize/Can.zig b/src/canonicalize/Can.zig index 53e6941392..d46ee445dd 100644 --- a/src/canonicalize/Can.zig +++ b/src/canonicalize/Can.zig @@ -2864,6 +2864,21 @@ fn importAliased( const current_scope = self.currentScope(); _ = try current_scope.introduceImportedModule(self.env.gpa, module_name_text, module_import_idx); + // 9. Check that this module actually exists, and if not report an error + if (self.module_envs) |envs_map| { + if (!envs_map.contains(module_name)) { + try self.env.pushDiagnostic(Diagnostic{ .module_not_found = .{ + .module_name = module_name, + .region = import_region, + } }); + } + } else { + try self.env.pushDiagnostic(Diagnostic{ .module_not_found = .{ + .module_name = module_name, + .region = import_region, + } }); + } + // If this import satisfies an exposed type requirement (e.g., platform re-exporting // an imported module), remove it from exposed_type_texts so we don't report // "EXPOSED BUT NOT DEFINED" for re-exported imports. @@ -2918,6 +2933,21 @@ fn importWithAlias( const current_scope = self.currentScope(); _ = try current_scope.introduceImportedModule(self.env.gpa, module_name_text, module_import_idx); + // 8. Check that this module actually exists, and if not report an error + if (self.module_envs) |envs_map| { + if (!envs_map.contains(module_name)) { + try self.env.pushDiagnostic(Diagnostic{ .module_not_found = .{ + .module_name = module_name, + .region = import_region, + } }); + } + } else { + try self.env.pushDiagnostic(Diagnostic{ .module_not_found = .{ + .module_name = module_name, + .region = import_region, + } }); + } + // If this import satisfies an exposed type requirement (e.g., platform re-exporting // an imported module), remove it from exposed_type_texts so we don't report // "EXPOSED BUT NOT DEFINED" for re-exported imports. @@ -2965,6 +2995,21 @@ fn importUnaliased( const current_scope = self.currentScope(); _ = try current_scope.introduceImportedModule(self.env.gpa, module_name_text, module_import_idx); + // 6. Check that this module actually exists, and if not report an error + if (self.module_envs) |envs_map| { + if (!envs_map.contains(module_name)) { + try self.env.pushDiagnostic(Diagnostic{ .module_not_found = .{ + .module_name = module_name, + .region = import_region, + } }); + } + } else { + try self.env.pushDiagnostic(Diagnostic{ .module_not_found = .{ + .module_name = module_name, + .region = import_region, + } }); + } + // If this import satisfies an exposed type requirement (e.g., platform re-exporting // an imported module), remove it from exposed_type_texts so we don't report // "EXPOSED BUT NOT DEFINED" for re-exported imports. diff --git a/src/canonicalize/test/import_validation_test.zig b/src/canonicalize/test/import_validation_test.zig index 1c36c97ce9..969878377f 100644 --- a/src/canonicalize/test/import_validation_test.zig +++ b/src/canonicalize/test/import_validation_test.zig @@ -164,13 +164,10 @@ test "import validation - mix of MODULE NOT FOUND, TYPE NOT EXPOSED, VALUE NOT E } } // Verify we got the expected errors - // Note: MODULE NOT FOUND is no longer reported during canonicalization because - // local imports are resolved later by the build system's scheduler. Only - // VALUE NOT EXPOSED and TYPE NOT EXPOSED are checked at canonicalization time. - try expectEqual(@as(u32, 0), module_not_found_count); // No longer reported at canonicalization + try expectEqual(@as(u32, 1), module_not_found_count); // NonExistent module try expectEqual(@as(u32, 1), value_not_exposed_count); // doesNotExist try expectEqual(@as(u32, 1), type_not_exposed_count); // InvalidType - try expectEqual(false, found_non_existent); // No longer reported at canonicalization + try expectEqual(true, found_non_existent); try expectEqual(true, found_does_not_exist); try expectEqual(true, found_invalid_type); // Verify that valid imports didn't generate errors @@ -211,9 +208,7 @@ test "import validation - no module_envs provided" { for (diagnostics) |diagnostic| { switch (diagnostic) { .module_not_found => { - // MODULE NOT FOUND is no longer reported at canonicalization time - // (local imports are resolved later by the scheduler) - try testing.expect(false); + // expected this error message, ignore }, .module_header_deprecated => { // expected deprecation warning, ignore diff --git a/src/check/test/type_checking_integration.zig b/src/check/test/type_checking_integration.zig index c66bde1a69..f54c0f2544 100644 --- a/src/check/test/type_checking_integration.zig +++ b/src/check/test/type_checking_integration.zig @@ -2228,3 +2228,66 @@ test "check type - pure zero-arg function annotation" { // Expected: zero-arg pure function returning empty record try checkTypesModule(source, .{ .pass = .last_def }, "({}) -> { }"); } + +test "imports of non-existent modules produce MODULE NOT FOUND errors" { + // This test verifies that importing modules that don't exist produces + // MODULE NOT FOUND errors. This is a regression test - a parser change + // for zero-arg functions accidentally caused these errors to disappear. + // + // Source from test/snapshots/can_import_comprehensive.md + const source = + \\import json.Json + \\import http.Client as Http exposing [get, post] + \\import utils.String as Str + \\ + \\main = { + \\ client = Http.get + \\ parser = Json.utf8 + \\ helper = Str.trim + \\ + \\ # Test direct module access + \\ result1 = Json.parse + \\ + \\ # Test aliased module access + \\ result2 = Http.post + \\ + \\ # Test exposed items (should work without module prefix) + \\ result3 = get + \\ result4 = post + \\ + \\ # Test multiple qualified access + \\ combined = Str.concat + \\ + \\ ( + \\ client, + \\ parser, + \\ helper, + \\ result1, + \\ result2, + \\ result3, + \\ result4, + \\ combined, + \\ ) + \\} + ; + + var test_env = try TestEnv.init("Test", source); + defer test_env.deinit(); + + const diagnostics = try test_env.module_env.getDiagnostics(); + defer test_env.gpa.free(diagnostics); + + // Count MODULE NOT FOUND errors + var module_not_found_count: usize = 0; + for (diagnostics) |diag| { + if (diag == .module_not_found) { + module_not_found_count += 1; + } + } + + // We expect exactly 3 MODULE NOT FOUND errors: + // 1. json.Json + // 2. http.Client + // 3. utils.String + try testing.expectEqual(@as(usize, 3), module_not_found_count); +} diff --git a/test/snapshots/can_import_comprehensive.md b/test/snapshots/can_import_comprehensive.md index a71aa07e90..c8b914a426 100644 --- a/test/snapshots/can_import_comprehensive.md +++ b/test/snapshots/can_import_comprehensive.md @@ -40,7 +40,10 @@ main = { } ~~~ # EXPECTED +MODULE NOT FOUND - can_import_comprehensive.md:1:1:1:17 +MODULE NOT FOUND - can_import_comprehensive.md:2:1:2:48 DUPLICATE DEFINITION - can_import_comprehensive.md:3:1:3:27 +MODULE NOT FOUND - can_import_comprehensive.md:3:1:3:27 UNDEFINED VARIABLE - can_import_comprehensive.md:6:14:6:22 UNDEFINED VARIABLE - can_import_comprehensive.md:7:14:7:23 UNDEFINED VARIABLE - can_import_comprehensive.md:8:14:8:22 @@ -50,6 +53,28 @@ UNDEFINED VARIABLE - can_import_comprehensive.md:17:15:17:18 UNDEFINED VARIABLE - can_import_comprehensive.md:18:15:18:19 UNDEFINED VARIABLE - can_import_comprehensive.md:21:16:21:26 # PROBLEMS +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_comprehensive.md:1:1:1:17:** +```roc +import json.Json +``` +^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `http.Client` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_comprehensive.md:2:1:2:48:** +```roc +import http.Client as Http exposing [get, post] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **DUPLICATE DEFINITION** The name `Str` is being redeclared in this scope. @@ -68,6 +93,17 @@ import json.Json ^ +**MODULE NOT FOUND** +The module `utils.String` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_comprehensive.md:3:1:3:27:** +```roc +import utils.String as Str +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `get` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/can_import_exposing_types.md b/test/snapshots/can_import_exposing_types.md index 093477f70e..7d681fc7ab 100644 --- a/test/snapshots/can_import_exposing_types.md +++ b/test/snapshots/can_import_exposing_types.md @@ -62,7 +62,10 @@ combineTrys = |jsonTry, httpStatus| UNDECLARED TYPE - can_import_exposing_types.md:29:18:29:24 UNDECLARED TYPE - can_import_exposing_types.md:30:18:30:24 UNDECLARED TYPE - can_import_exposing_types.md:31:23:31:31 +MODULE NOT FOUND - can_import_exposing_types.md:1:1:1:49 +MODULE NOT FOUND - can_import_exposing_types.md:2:1:2:64 DUPLICATE DEFINITION - can_import_exposing_types.md:3:1:3:32 +MODULE NOT FOUND - can_import_exposing_types.md:3:1:3:32 UNDECLARED TYPE - can_import_exposing_types.md:6:24:6:29 UNDECLARED TYPE - can_import_exposing_types.md:6:31:6:36 UNDEFINED VARIABLE - can_import_exposing_types.md:7:21:7:31 @@ -122,6 +125,28 @@ This type is referenced here: ^^^^^^^^ +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_exposing_types.md:1:1:1:49:** +```roc +import json.Json exposing [Value, Error, Config] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `http.Client` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_exposing_types.md:2:1:2:64:** +```roc +import http.Client as Http exposing [Request, Response, Status] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **DUPLICATE DEFINITION** The name `Try` is being redeclared in this scope. @@ -140,6 +165,17 @@ import json.Json exposing [Value, Error, Config] ^ +**MODULE NOT FOUND** +The module `utils.Try` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_exposing_types.md:3:1:3:32:** +```roc +import utils.Try exposing [Try] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDECLARED TYPE** The type _Value_ is not declared in this scope. diff --git a/test/snapshots/can_import_json.md b/test/snapshots/can_import_json.md index 182e007586..2b8a259644 100644 --- a/test/snapshots/can_import_json.md +++ b/test/snapshots/can_import_json.md @@ -10,8 +10,20 @@ import json.Json main = Json.utf8 ~~~ # EXPECTED +MODULE NOT FOUND - can_import_json.md:1:1:1:17 UNDEFINED VARIABLE - can_import_json.md:3:8:3:17 # PROBLEMS +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_json.md:1:1:1:17:** +```roc +import json.Json +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `utf8` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/can_import_nested_modules.md b/test/snapshots/can_import_nested_modules.md index a04b2c099f..00f228b910 100644 --- a/test/snapshots/can_import_nested_modules.md +++ b/test/snapshots/can_import_nested_modules.md @@ -31,6 +31,9 @@ validateAuth : HttpAuth.Credentials -> Try(HttpAuth.Token, HttpAuth.Error) validateAuth = |creds| HttpAuth.validate(creds) ~~~ # EXPECTED +MODULE NOT FOUND - can_import_nested_modules.md:1:1:1:26 +MODULE NOT FOUND - can_import_nested_modules.md:2:1:2:36 +MODULE NOT FOUND - can_import_nested_modules.md:3:1:3:46 MODULE NOT IMPORTED - can_import_nested_modules.md:6:15:6:30 DOES NOT EXIST - can_import_nested_modules.md:7:26:7:41 UNDEFINED VARIABLE - can_import_nested_modules.md:11:29:11:43 @@ -41,6 +44,39 @@ UNDEFINED VARIABLE - can_import_nested_modules.md:20:23:20:30 DOES NOT EXIST - can_import_nested_modules.md:20:37:20:58 UNDEFINED VARIABLE - can_import_nested_modules.md:24:24:24:41 # PROBLEMS +**MODULE NOT FOUND** +The module `json.Parser` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_nested_modules.md:1:1:1:26:** +```roc +import json.Parser.Config +``` +^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `http.Client.Auth` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_nested_modules.md:2:1:2:36:** +```roc +import http.Client.Auth as HttpAuth +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `utils.String.Format` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_nested_modules.md:3:1:3:46:** +```roc +import utils.String.Format exposing [padLeft] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **MODULE NOT IMPORTED** There is no module with the name `Config` imported into this Roc file. diff --git a/test/snapshots/can_import_type_annotations.md b/test/snapshots/can_import_type_annotations.md index 832eec900c..9edb6b6ee1 100644 --- a/test/snapshots/can_import_type_annotations.md +++ b/test/snapshots/can_import_type_annotations.md @@ -44,7 +44,10 @@ combineTrys = |result1, result2| } ~~~ # EXPECTED +MODULE NOT FOUND - can_import_type_annotations.md:1:1:1:56 +MODULE NOT FOUND - can_import_type_annotations.md:2:1:2:17 DUPLICATE DEFINITION - can_import_type_annotations.md:3:1:3:32 +MODULE NOT FOUND - can_import_type_annotations.md:3:1:3:32 UNDECLARED TYPE - can_import_type_annotations.md:5:18:5:25 UNDECLARED TYPE - can_import_type_annotations.md:5:29:5:37 UNDEFINED VARIABLE - can_import_type_annotations.md:6:24:6:44 @@ -57,6 +60,28 @@ MODULE NOT IMPORTED - can_import_type_annotations.md:24:18:24:36 MODULE NOT IMPORTED - can_import_type_annotations.md:24:61:24:78 UNDEFINED VARIABLE - can_import_type_annotations.md:25:40:25:61 # PROBLEMS +**MODULE NOT FOUND** +The module `http.Client` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_type_annotations.md:1:1:1:56:** +```roc +import http.Client as Http exposing [Request, Response] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_type_annotations.md:2:1:2:17:** +```roc +import json.Json +``` +^^^^^^^^^^^^^^^^ + + **DUPLICATE DEFINITION** The name `Try` is being redeclared in this scope. @@ -75,6 +100,17 @@ import http.Client as Http exposing [Request, Response] ^ +**MODULE NOT FOUND** +The module `utils.Try` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_type_annotations.md:3:1:3:32:** +```roc +import utils.Try exposing [Try] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDECLARED TYPE** The type _Request_ is not declared in this scope. diff --git a/test/snapshots/can_import_unresolved_qualified.md b/test/snapshots/can_import_unresolved_qualified.md index 209d0c1ca1..25ff2522eb 100644 --- a/test/snapshots/can_import_unresolved_qualified.md +++ b/test/snapshots/can_import_unresolved_qualified.md @@ -32,6 +32,8 @@ client = Http.invalidMethod parser = Json.Parser.Advanced.NonExistent.create ~~~ # EXPECTED +MODULE NOT FOUND - can_import_unresolved_qualified.md:1:1:1:17 +MODULE NOT FOUND - can_import_unresolved_qualified.md:2:1:2:27 UNDEFINED VARIABLE - can_import_unresolved_qualified.md:5:8:5:31 UNDEFINED VARIABLE - can_import_unresolved_qualified.md:9:20:9:34 MODULE NOT IMPORTED - can_import_unresolved_qualified.md:12:18:12:37 @@ -43,6 +45,28 @@ DOES NOT EXIST - can_import_unresolved_qualified.md:19:10:19:31 UNDEFINED VARIABLE - can_import_unresolved_qualified.md:22:10:22:28 UNDEFINED VARIABLE - can_import_unresolved_qualified.md:25:10:25:49 # PROBLEMS +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_unresolved_qualified.md:1:1:1:17:** +```roc +import json.Json +``` +^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `http.Client` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_unresolved_qualified.md:2:1:2:27:** +```roc +import http.Client as Http +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `method` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/can_import_with_alias.md b/test/snapshots/can_import_with_alias.md index b718b193b1..ddf5b8a9fb 100644 --- a/test/snapshots/can_import_with_alias.md +++ b/test/snapshots/can_import_with_alias.md @@ -10,8 +10,20 @@ import json.Json as MyJson main = MyJson.decode ~~~ # EXPECTED +MODULE NOT FOUND - can_import_with_alias.md:1:1:1:27 UNDEFINED VARIABLE - can_import_with_alias.md:3:8:3:21 # PROBLEMS +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**can_import_with_alias.md:1:1:1:27:** +```roc +import json.Json as MyJson +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `decode` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/effectful_with_effectful_annotation.md b/test/snapshots/effectful_with_effectful_annotation.md index cdb35ff8cd..a1e192abb1 100644 --- a/test/snapshots/effectful_with_effectful_annotation.md +++ b/test/snapshots/effectful_with_effectful_annotation.md @@ -16,8 +16,20 @@ print_msg! = |msg| Stdout.line!(msg) main! = print_msg!("Hello, world!") ~~~ # EXPECTED +MODULE NOT FOUND - effectful_with_effectful_annotation.md:3:1:3:17 UNDEFINED VARIABLE - effectful_with_effectful_annotation.md:7:20:7:32 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**effectful_with_effectful_annotation.md:3:1:3:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `line!` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/exposed_items_test.md b/test/snapshots/exposed_items_test.md index 22005df725..b8ecab2366 100644 --- a/test/snapshots/exposed_items_test.md +++ b/test/snapshots/exposed_items_test.md @@ -10,9 +10,19 @@ import pf.Stdout exposing [line!, write!] main = 42 ~~~ # EXPECTED -NIL +MODULE NOT FOUND - exposed_items_test.md:1:1:1:42 # PROBLEMS -NIL +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**exposed_items_test.md:1:1:1:42:** +```roc +import pf.Stdout exposing [line!, write!] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent,KwExposing,OpenSquare,LowerIdent,Comma,LowerIdent,CloseSquare, diff --git a/test/snapshots/external_decl_lookup.md b/test/snapshots/external_decl_lookup.md index 3798a242e2..69509d6b61 100644 --- a/test/snapshots/external_decl_lookup.md +++ b/test/snapshots/external_decl_lookup.md @@ -17,9 +17,33 @@ main! = |_| { } ~~~ # EXPECTED +MODULE NOT FOUND - external_decl_lookup.md:3:1:3:17 +MODULE NOT FOUND - external_decl_lookup.md:4:1:4:17 UNDEFINED VARIABLE - external_decl_lookup.md:8:14:8:23 UNDEFINED VARIABLE - external_decl_lookup.md:9:5:9:17 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**external_decl_lookup.md:3:1:3:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**external_decl_lookup.md:4:1:4:17:** +```roc +import json.Json +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `utf8` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/file/inline_ingested_file.md b/test/snapshots/file/inline_ingested_file.md index 36197941ba..8d01f05bc9 100644 --- a/test/snapshots/file/inline_ingested_file.md +++ b/test/snapshots/file/inline_ingested_file.md @@ -15,6 +15,7 @@ PARSE ERROR - inline_ingested_file.md:1:8:1:9 PARSE ERROR - inline_ingested_file.md:1:9:1:19 PARSE ERROR - inline_ingested_file.md:1:19:1:20 PARSE ERROR - inline_ingested_file.md:1:21:1:23 +MODULE NOT FOUND - inline_ingested_file.md:2:1:2:12 UNDEFINED VARIABLE - inline_ingested_file.md:4:7:4:17 # PROBLEMS **PARSE ERROR** @@ -61,6 +62,17 @@ import "users.json" as data : Str ^^ +**MODULE NOT FOUND** +The module `Json` was not found in this Roc project. + +You're attempting to use this module here: +**inline_ingested_file.md:2:1:2:12:** +```roc +import Json +``` +^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `parse` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/file/underscore_type_decl.md b/test/snapshots/file/underscore_type_decl.md index ba9bbcc4ed..0fdb49c350 100644 --- a/test/snapshots/file/underscore_type_decl.md +++ b/test/snapshots/file/underscore_type_decl.md @@ -34,6 +34,7 @@ PARSE ERROR - underscore_type_decl.md:5:13:5:14 PARSE ERROR - underscore_type_decl.md:5:20:5:21 PARSE ERROR - underscore_type_decl.md:5:23:5:24 PARSE ERROR - underscore_type_decl.md:6:1:6:1 +MODULE NOT FOUND - underscore_type_decl.md:1:1:1:30 # PROBLEMS **PARSE ERROR** Type applications require parentheses around their type arguments. @@ -325,6 +326,17 @@ Other valid examples: ^ +**MODULE NOT FOUND** +The module `Module` was not found in this Roc project. + +You're attempting to use this module here: +**underscore_type_decl.md:1:1:1:30:** +```roc +import Module exposing [Pair] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,UpperIdent,KwExposing,OpenSquare,UpperIdent,CloseSquare, diff --git a/test/snapshots/formatting/multiline/everything.md b/test/snapshots/formatting/multiline/everything.md index e0ede50b3c..62a234b696 100644 --- a/test/snapshots/formatting/multiline/everything.md +++ b/test/snapshots/formatting/multiline/everything.md @@ -123,6 +123,8 @@ h = |x, y| { # EXPECTED WHERE CLAUSE NOT ALLOWED IN TYPE DECLARATION - everything.md:12:1:22:3 WHERE CLAUSE NOT ALLOWED IN TYPE DECLARATION - everything.md:23:1:33:3 +MODULE NOT FOUND - everything.md:2:1:5:2 +MODULE NOT FOUND - everything.md:6:1:9:2 EXPECTED NOMINAL TYPE - everything.md:77:7:80:3 UNUSED VARIABLE - everything.md:94:5:94:6 UNUSED VARIABLE - everything.md:99:4:99:5 @@ -174,6 +176,32 @@ B(b) : b ``` +**MODULE NOT FOUND** +The module `I1` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:2:1:5:2:** +```roc +import I1 exposing [ + I11, + I12, +] +``` + + +**MODULE NOT FOUND** +The module `I2` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:6:1:9:2:** +```roc +import I2 exposing [ + I21 as Ias1, + I22 as Ias2, +] +``` + + **EXPECTED NOMINAL TYPE** You are using the type _A_ like a nominal type, but it is an alias. diff --git a/test/snapshots/formatting/multiline_without_comma/everything.md b/test/snapshots/formatting/multiline_without_comma/everything.md index a4f4fc756d..203fee8542 100644 --- a/test/snapshots/formatting/multiline_without_comma/everything.md +++ b/test/snapshots/formatting/multiline_without_comma/everything.md @@ -200,6 +200,8 @@ PARSE ERROR - everything.md:56:40:56:42 MALFORMED WHERE CLAUSE - everything.md:56:12:56:17 WHERE CLAUSE NOT ALLOWED IN TYPE DECLARATION - everything.md:12:1:13:7 UNDECLARED TYPE - everything.md:43:5:43:6 +MODULE NOT FOUND - everything.md:2:1:5:2 +MODULE NOT FOUND - everything.md:6:1:9:2 EXPECTED NOMINAL TYPE - everything.md:71:7:74:3 UNUSED VARIABLE - everything.md:88:5:88:6 UNUSED VARIABLE - everything.md:93:4:93:5 @@ -1206,6 +1208,32 @@ This type is referenced here: ^ +**MODULE NOT FOUND** +The module `I1` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:2:1:5:2:** +```roc +import I1 exposing [ + I11, + I12 +] +``` + + +**MODULE NOT FOUND** +The module `I2` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:6:1:9:2:** +```roc +import I2 exposing [ + I21 as Ias1, + I22 as Ias2 +] +``` + + **EXPECTED NOMINAL TYPE** You are using the type _A_ like a nominal type, but it is an alias. diff --git a/test/snapshots/formatting/singleline/everything.md b/test/snapshots/formatting/singleline/everything.md index 6ae68cbc65..f89a1ba30f 100644 --- a/test/snapshots/formatting/singleline/everything.md +++ b/test/snapshots/formatting/singleline/everything.md @@ -38,6 +38,8 @@ h = |x, y| { # EXPECTED WHERE CLAUSE NOT ALLOWED IN TYPE DECLARATION - everything.md:6:1:6:60 WHERE CLAUSE NOT ALLOWED IN TYPE DECLARATION - everything.md:7:1:7:60 +MODULE NOT FOUND - everything.md:2:1:2:30 +MODULE NOT FOUND - everything.md:3:1:3:46 EXPECTED NOMINAL TYPE - everything.md:19:7:19:14 UNUSED VARIABLE - everything.md:24:10:24:11 UNUSED VARIABLE - everything.md:25:9:25:10 @@ -71,6 +73,28 @@ B(b) : b where [b.b1 : (b, b) -> Str, b.b2 : (b, b) -> Str] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**MODULE NOT FOUND** +The module `I1` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:2:1:2:30:** +```roc +import I1 exposing [I11, I12] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `I2` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:3:1:3:46:** +```roc +import I2 exposing [I21 as Ias1, I22 as Ias2] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **EXPECTED NOMINAL TYPE** You are using the type _A_ like a nominal type, but it is an alias. diff --git a/test/snapshots/formatting/singleline_with_comma/everything.md b/test/snapshots/formatting/singleline_with_comma/everything.md index 35a7355dd6..807102b62d 100644 --- a/test/snapshots/formatting/singleline_with_comma/everything.md +++ b/test/snapshots/formatting/singleline_with_comma/everything.md @@ -38,6 +38,8 @@ h = |x, y,| { # EXPECTED WHERE CLAUSE NOT ALLOWED IN TYPE DECLARATION - everything.md:6:1:6:63 WHERE CLAUSE NOT ALLOWED IN TYPE DECLARATION - everything.md:7:1:7:63 +MODULE NOT FOUND - everything.md:2:1:2:31 +MODULE NOT FOUND - everything.md:3:1:3:47 EXPECTED NOMINAL TYPE - everything.md:19:7:19:15 UNUSED VARIABLE - everything.md:24:10:24:11 UNUSED VARIABLE - everything.md:25:9:25:10 @@ -71,6 +73,28 @@ B(b) : b where [b.b1 : (b, b,) -> Str, b.b2 : (b, b,) -> Str,] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +**MODULE NOT FOUND** +The module `I1` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:2:1:2:31:** +```roc +import I1 exposing [I11, I12,] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `I2` was not found in this Roc project. + +You're attempting to use this module here: +**everything.md:3:1:3:47:** +```roc +import I2 exposing [I21 as Ias1, I22 as Ias2,] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **EXPECTED NOMINAL TYPE** You are using the type _A_ like a nominal type, but it is an alias. diff --git a/test/snapshots/function_no_annotation.md b/test/snapshots/function_no_annotation.md index 189e30c3ef..dc56dd5f47 100644 --- a/test/snapshots/function_no_annotation.md +++ b/test/snapshots/function_no_annotation.md @@ -21,8 +21,20 @@ process! = |x| print_number!(multiply(x, 2)) main! = process!(42) ~~~ # EXPECTED +MODULE NOT FOUND - function_no_annotation.md:3:1:3:17 UNDEFINED VARIABLE - function_no_annotation.md:9:21:9:33 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**function_no_annotation.md:3:1:3:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `line!` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/fuzz_crash/fuzz_crash_019.md b/test/snapshots/fuzz_crash/fuzz_crash_019.md index 6e4b49531d..e9def4620b 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_019.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_019.md @@ -141,6 +141,10 @@ UNDECLARED TYPE VARIABLE - fuzz_crash_019.md:19:4:19:6 UNDECLARED TYPE VARIABLE - fuzz_crash_019.md:20:12:20:13 UNDECLARED TYPE - fuzz_crash_019.md:24:15:24:16 UNDECLARED TYPE VARIABLE - fuzz_crash_019.md:24:24:24:25 +MODULE NOT FOUND - fuzz_crash_019.md:4:1:4:34 +MODULE NOT FOUND - fuzz_crash_019.md:6:1:8:6 +MODULE NOT FOUND - fuzz_crash_019.md:10:1:10:19 +MODULE NOT FOUND - fuzz_crash_019.md:11:1:12:4 UNDECLARED TYPE - fuzz_crash_019.md:37:7:37:9 UNDEFINED VARIABLE - fuzz_crash_019.md:42:4:42:5 UNDEFINED VARIABLE - fuzz_crash_019.md:42:6:42:10 @@ -346,6 +350,51 @@ Som : { foo : O, bar : g } ^ +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_019.md:4:1:4:34:** +```roc +import pf.Stdout exposing [line!] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `Stdot` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_019.md:6:1:8:6:** +```roc +import Stdot + exposing [ #tem +Cust] +``` + + +**MODULE NOT FOUND** +The module `Bae` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_019.md:10:1:10:19:** +```roc +import Bae as Gooe +``` +^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `Ba` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_019.md:11:1:12:4:** +```roc +import + Ba +``` + + **UNDECLARED TYPE** The type _U6_ is not declared in this scope. diff --git a/test/snapshots/fuzz_crash/fuzz_crash_020.md b/test/snapshots/fuzz_crash/fuzz_crash_020.md index 0b7a04622a..5222b2e438 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_020.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_020.md @@ -141,6 +141,10 @@ UNDECLARED TYPE VARIABLE - fuzz_crash_020.md:19:4:19:6 UNDECLARED TYPE VARIABLE - fuzz_crash_020.md:20:12:20:13 UNDECLARED TYPE - fuzz_crash_020.md:24:15:24:16 UNDECLARED TYPE VARIABLE - fuzz_crash_020.md:24:24:24:25 +MODULE NOT FOUND - fuzz_crash_020.md:4:1:4:34 +MODULE NOT FOUND - fuzz_crash_020.md:6:1:8:6 +MODULE NOT FOUND - fuzz_crash_020.md:10:1:10:19 +MODULE NOT FOUND - fuzz_crash_020.md:11:1:12:4 UNDECLARED TYPE - fuzz_crash_020.md:37:7:37:9 UNDEFINED VARIABLE - fuzz_crash_020.md:40:5:40:8 UNDEFINED VARIABLE - fuzz_crash_020.md:42:4:42:5 @@ -345,6 +349,51 @@ Som : { foo : O, bar : g } ^ +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_020.md:4:1:4:34:** +```roc +import pf.Stdout exposing [line!] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `Stdot` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_020.md:6:1:8:6:** +```roc +import Stdot + exposing [ #tem +Cust] +``` + + +**MODULE NOT FOUND** +The module `Bae` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_020.md:10:1:10:19:** +```roc +import Bae as Gooe +``` +^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `Ba` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_020.md:11:1:12:4:** +```roc +import + Ba +``` + + **UNDECLARED TYPE** The type _U6_ is not declared in this scope. diff --git a/test/snapshots/fuzz_crash/fuzz_crash_023.md b/test/snapshots/fuzz_crash/fuzz_crash_023.md index 4099b43c00..eaec4e7931 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_023.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_023.md @@ -229,7 +229,12 @@ UNDECLARED TYPE - fuzz_crash_023.md:45:8:45:10 UNDECLARED TYPE - fuzz_crash_023.md:46:8:46:17 UNDECLARED TYPE - fuzz_crash_023.md:52:4:52:6 UNDECLARED TYPE - fuzz_crash_023.md:53:8:53:17 +MODULE NOT FOUND - fuzz_crash_023.md:4:1:4:42 NOT IMPLEMENTED - :0:0:0:0 +MODULE NOT FOUND - fuzz_crash_023.md:6:1:12:4 +MODULE NOT FOUND - fuzz_crash_023.md:14:1:14:82 +MODULE NOT FOUND - fuzz_crash_023.md:16:1:16:27 +MODULE NOT FOUND - fuzz_crash_023.md:17:1:20:20 UNDEFINED VARIABLE - fuzz_crash_023.md:72:4:72:13 UNUSED VARIABLE - fuzz_crash_023.md:97:3:97:8 UNUSED VARIABLE - fuzz_crash_023.md:1:1:1:1 @@ -442,11 +447,73 @@ This type is referenced here: ^^^^^^^^^ +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_023.md:4:1:4:42:** +```roc +import pf.Stdout exposing [line!, write!] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **NOT IMPLEMENTED** This feature is not yet implemented: malformed import module name contains invalid control characters This error doesn't have a proper diagnostic report yet. Let us know if you want to help improve Roc's error messages! +**MODULE NOT FOUND** +The module `MALFORMED_IMPORT` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_023.md:6:1:12:4:** +```roc +import # Comment after import keyword + pf # Comment after qualifier + .StdoutMultiline # Comment after ident + exposing [ # Comment after exposing open + line!, # Comment after exposed item + write!, # Another after exposed item + ] # Comment after exposing close +``` + + +**MODULE NOT FOUND** +The module `pkg.Something` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_023.md:14:1:14:82:** +```roc +import pkg.Something exposing [func as function, Type as ValueCategory, Custom.*] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `BadName` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_023.md:16:1:16:27:** +```roc +import BadName as GoodName +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `BadNameMultiline` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_023.md:17:1:20:20:** +```roc +import + BadNameMultiline + as + GoodNameMultiline +``` + + **UNDEFINED VARIABLE** Nothing is named `some_func` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/fuzz_crash/fuzz_crash_027.md b/test/snapshots/fuzz_crash/fuzz_crash_027.md index 2929da28c5..89e86c4fdd 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_027.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_027.md @@ -182,6 +182,11 @@ UNDECLARED TYPE - fuzz_crash_027.md:34:8:34:11 UNDECLARED TYPE - fuzz_crash_027.md:38:8:38:11 UNDECLARED TYPE - fuzz_crash_027.md:43:11:43:16 UNDECLARED TYPE - fuzz_crash_027.md:43:26:43:31 +MODULE NOT FOUND - fuzz_crash_027.md:4:1:4:38 +MODULE NOT FOUND - fuzz_crash_027.md:6:1:8:4 +MODULE NOT FOUND - fuzz_crash_027.md:10:1:10:46 +MODULE NOT FOUND - fuzz_crash_027.md:12:1:12:19 +MODULE NOT FOUND - fuzz_crash_027.md:13:1:14:4 UNDECLARED TYPE - fuzz_crash_027.md:29:2:29:5 UNDECLARED TYPE - fuzz_crash_027.md:30:2:30:5 EMPTY TUPLE NOT ALLOWED - fuzz_crash_027.md:52:1:52:3 @@ -410,6 +415,62 @@ Func(a) : Maybe(a), a -> Maybe(a) ^^^^^ +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_027.md:4:1:4:38:** +```roc +import pf.Stdout exposing [line!, e!] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `Stdot` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_027.md:6:1:8:4:** +```roc +import Stdot + exposing [ #tem + ] # Cose +``` + + +**MODULE NOT FOUND** +The module `pkg.S` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_027.md:10:1:10:46:** +```roc +import pkg.S exposing [func as fry, Custom.*] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `Bae` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_027.md:12:1:12:19:** +```roc +import Bae as Gooe +``` +^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `Ba` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_027.md:13:1:14:4:** +```roc +import + Ba +``` + + **UNDECLARED TYPE** The type _Bar_ is not declared in this scope. diff --git a/test/snapshots/fuzz_crash/fuzz_crash_028.md b/test/snapshots/fuzz_crash/fuzz_crash_028.md index d187c128a8..ffedd15fd3 100644 Binary files a/test/snapshots/fuzz_crash/fuzz_crash_028.md and b/test/snapshots/fuzz_crash/fuzz_crash_028.md differ diff --git a/test/snapshots/fuzz_crash/fuzz_crash_042.md b/test/snapshots/fuzz_crash/fuzz_crash_042.md index cf5d1f3389..537b108063 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_042.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_042.md @@ -10,6 +10,7 @@ import u.R}g:r->R.a.E # EXPECTED PARSE ERROR - fuzz_crash_042.md:1:11:1:12 MODULE NOT IMPORTED - fuzz_crash_042.md:1:17:1:22 +MODULE NOT FOUND - fuzz_crash_042.md:1:1:1:11 # PROBLEMS **PARSE ERROR** A parsing error occurred: `statement_unexpected_token` @@ -33,6 +34,17 @@ import u.R}g:r->R.a.E ^^^^^ +**MODULE NOT FOUND** +The module `u.R` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_042.md:1:1:1:11:** +```roc +import u.R}g:r->R.a.E +``` +^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent,CloseCurly,LowerIdent,OpColon,LowerIdent,OpArrow,UpperIdent,NoSpaceDotLowerIdent,NoSpaceDotUpperIdent, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_049.md b/test/snapshots/fuzz_crash/fuzz_crash_049.md index 909c860694..7196ec340b 100644 Binary files a/test/snapshots/fuzz_crash/fuzz_crash_049.md and b/test/snapshots/fuzz_crash/fuzz_crash_049.md differ diff --git a/test/snapshots/fuzz_crash/fuzz_crash_054.md b/test/snapshots/fuzz_crash/fuzz_crash_054.md index ee01d4c571..e8436b84fc 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_054.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_054.md @@ -9,9 +9,19 @@ app[]{f:platform""}import S exposing[c as f] ~~~ # EXPECTED -NIL +MODULE NOT FOUND - fuzz_crash_054.md:1:20:2:3 # PROBLEMS -NIL +**MODULE NOT FOUND** +The module `S` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_054.md:1:20:2:3:** +```roc +app[]{f:platform""}import S exposing[c as +f] +``` + + # TOKENS ~~~zig KwApp,OpenSquare,CloseSquare,OpenCurly,LowerIdent,OpColon,KwPlatform,StringStart,StringPart,StringEnd,CloseCurly,KwImport,UpperIdent,KwExposing,OpenSquare,LowerIdent,KwAs, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_059.md b/test/snapshots/fuzz_crash/fuzz_crash_059.md index e48a67cc0a..f55ae8b1dd 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_059.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_059.md @@ -17,6 +17,7 @@ PARSE ERROR - fuzz_crash_059.md:2:9:2:13 PARSE ERROR - fuzz_crash_059.md:2:13:2:14 PARSE ERROR - fuzz_crash_059.md:2:14:2:15 PARSE ERROR - fuzz_crash_059.md:2:15:2:16 +MODULE NOT FOUND - fuzz_crash_059.md:1:20:2:2 # PROBLEMS **PARSE ERROR** A parsing error occurred: `statement_unexpected_token` @@ -106,6 +107,17 @@ G if 0{}else||0 ^ +**MODULE NOT FOUND** +The module `B` was not found in this Roc project. + +You're attempting to use this module here: +**fuzz_crash_059.md:1:20:2:2:** +```roc +app[]{f:platform""}import B as +G if 0{}else||0 +``` + + # TOKENS ~~~zig KwApp,OpenSquare,CloseSquare,OpenCurly,LowerIdent,OpColon,KwPlatform,StringStart,StringPart,StringEnd,CloseCurly,KwImport,UpperIdent,KwAs, diff --git a/test/snapshots/hello_world.md b/test/snapshots/hello_world.md index 0c193b6e36..a6419540fd 100644 --- a/test/snapshots/hello_world.md +++ b/test/snapshots/hello_world.md @@ -12,8 +12,20 @@ import pf.Stdout main! = |_| Stdout.line!("Hello, world!") ~~~ # EXPECTED +MODULE NOT FOUND - hello_world.md:3:1:3:17 UNDEFINED VARIABLE - hello_world.md:5:13:5:25 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**hello_world.md:3:1:3:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `line!` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/hello_world_with_block.md b/test/snapshots/hello_world_with_block.md index 84930fe9e5..c7eef4e0ae 100644 --- a/test/snapshots/hello_world_with_block.md +++ b/test/snapshots/hello_world_with_block.md @@ -19,9 +19,21 @@ main! = |_| { } ~~~ # EXPECTED +MODULE NOT FOUND - hello_world_with_block.md:6:1:6:17 UNDEFINED VARIABLE - hello_world_with_block.md:11:2:11:14 UNUSED VARIABLE - hello_world_with_block.md:9:2:9:7 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**hello_world_with_block.md:6:1:6:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `line!` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/import_exposing_alias.md b/test/snapshots/import_exposing_alias.md index af077fcc52..6aeb80dda4 100644 --- a/test/snapshots/import_exposing_alias.md +++ b/test/snapshots/import_exposing_alias.md @@ -15,9 +15,21 @@ main = { } ~~~ # EXPECTED +MODULE NOT FOUND - import_exposing_alias.md:1:1:1:65 UNDEFINED VARIABLE - import_exposing_alias.md:5:12:5:18 UNDEFINED VARIABLE - import_exposing_alias.md:6:12:6:20 # PROBLEMS +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**import_exposing_alias.md:1:1:1:65:** +```roc +import json.Json exposing [decode as fromJson, encode as toJson] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `toJson` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/import_exposing_basic.md b/test/snapshots/import_exposing_basic.md index 2a3b5d9135..34797102d4 100644 --- a/test/snapshots/import_exposing_basic.md +++ b/test/snapshots/import_exposing_basic.md @@ -15,9 +15,21 @@ main = { } ~~~ # EXPECTED +MODULE NOT FOUND - import_exposing_basic.md:1:1:1:43 UNDEFINED VARIABLE - import_exposing_basic.md:5:15:5:21 UNDEFINED VARIABLE - import_exposing_basic.md:6:15:6:21 # PROBLEMS +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**import_exposing_basic.md:1:1:1:43:** +```roc +import json.Json exposing [decode, encode] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `encode` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/multi_qualified_import.md b/test/snapshots/multi_qualified_import.md index bf4b6ae4cb..f9fc0c0d4b 100644 --- a/test/snapshots/multi_qualified_import.md +++ b/test/snapshots/multi_qualified_import.md @@ -27,6 +27,7 @@ PARSE ERROR - multi_qualified_import.md:12:30:12:31 PARSE ERROR - multi_qualified_import.md:12:31:12:36 PARSE ERROR - multi_qualified_import.md:12:36:12:37 PARSE ERROR - multi_qualified_import.md:12:37:12:38 +MODULE NOT FOUND - multi_qualified_import.md:1:1:1:41 UNDECLARED TYPE - multi_qualified_import.md:3:16:3:23 DOES NOT EXIST - multi_qualified_import.md:4:16:4:45 MODULE NOT IMPORTED - multi_qualified_import.md:7:11:7:33 @@ -122,6 +123,17 @@ data = json.Core.Utf8.encode("hello") ^ +**MODULE NOT FOUND** +The module `json.Core.Utf8` was not found in this Roc project. + +You're attempting to use this module here: +**multi_qualified_import.md:1:1:1:41:** +```roc +import json.Core.Utf8 exposing [Encoder] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDECLARED TYPE** The type _Encoder_ is not declared in this scope. diff --git a/test/snapshots/nominal/nominal_external_fully_qualified.md b/test/snapshots/nominal/nominal_external_fully_qualified.md index 8bbc69b954..675291ef62 100644 --- a/test/snapshots/nominal/nominal_external_fully_qualified.md +++ b/test/snapshots/nominal/nominal_external_fully_qualified.md @@ -16,8 +16,20 @@ handleTry = |result| { } ~~~ # EXPECTED +MODULE NOT FOUND - nominal_external_fully_qualified.md:1:1:1:19 UNUSED VARIABLE - nominal_external_fully_qualified.md:7:35:7:39 # PROBLEMS +**MODULE NOT FOUND** +The module `MyTryModule` was not found in this Roc project. + +You're attempting to use this module here: +**nominal_external_fully_qualified.md:1:1:1:19:** +```roc +import MyTryModule +``` +^^^^^^^^^^^^^^^^^^ + + **UNUSED VARIABLE** Variable `code` is not used anywhere in your code. diff --git a/test/snapshots/nominal/nominal_import_long_package.md b/test/snapshots/nominal/nominal_import_long_package.md index 7de27bfc6b..c57f848bc8 100644 --- a/test/snapshots/nominal/nominal_import_long_package.md +++ b/test/snapshots/nominal/nominal_import_long_package.md @@ -11,8 +11,20 @@ red : CE red = ... # not implemented ~~~ # EXPECTED +MODULE NOT FOUND - nominal_import_long_package.md:1:1:1:52 UNDECLARED TYPE - nominal_import_long_package.md:3:7:3:9 # PROBLEMS +**MODULE NOT FOUND** +The module `design.Styles.Color` was not found in this Roc project. + +You're attempting to use this module here: +**nominal_import_long_package.md:1:1:1:52:** +```roc +import design.Styles.Color exposing [Encoder as CE] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDECLARED TYPE** The type _CE_ is not declared in this scope. diff --git a/test/snapshots/nominal/nominal_import_type.md b/test/snapshots/nominal/nominal_import_type.md index a5b5d5d5d9..ffe04a2afa 100644 --- a/test/snapshots/nominal/nominal_import_type.md +++ b/test/snapshots/nominal/nominal_import_type.md @@ -11,9 +11,19 @@ red : Color.RGB red = Color.RGB.Red ~~~ # EXPECTED -NIL +MODULE NOT FOUND - nominal_import_type.md:1:1:1:13 # PROBLEMS -NIL +**MODULE NOT FOUND** +The module `Color` was not found in this Roc project. + +You're attempting to use this module here: +**nominal_import_type.md:1:1:1:13:** +```roc +import Color +``` +^^^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,UpperIdent, diff --git a/test/snapshots/nominal/nominal_import_wildcard.md b/test/snapshots/nominal/nominal_import_wildcard.md index 1e82019485..39fb4c597b 100644 --- a/test/snapshots/nominal/nominal_import_wildcard.md +++ b/test/snapshots/nominal/nominal_import_wildcard.md @@ -18,6 +18,7 @@ green = Green ~~~ # EXPECTED PARSE ERROR - nominal_import_wildcard.md:1:13:1:15 +MODULE NOT FOUND - nominal_import_wildcard.md:1:1:1:13 UNDECLARED TYPE - nominal_import_wildcard.md:3:7:3:12 UNDECLARED TYPE - nominal_import_wildcard.md:6:8:6:13 UNDECLARED TYPE - nominal_import_wildcard.md:9:9:9:14 @@ -33,6 +34,17 @@ import Color.* ^^ +**MODULE NOT FOUND** +The module `Color` was not found in this Roc project. + +You're attempting to use this module here: +**nominal_import_wildcard.md:1:1:1:13:** +```roc +import Color.* +``` +^^^^^^^^^^^^ + + **UNDECLARED TYPE** The type _Color_ is not declared in this scope. diff --git a/test/snapshots/nominal/nominal_tag_package_import.md b/test/snapshots/nominal/nominal_tag_package_import.md index ebaabe50ba..4bd3981d32 100644 --- a/test/snapshots/nominal/nominal_tag_package_import.md +++ b/test/snapshots/nominal/nominal_tag_package_import.md @@ -13,9 +13,19 @@ blue : CC.Color blue = CC.Color.RGB(0,0,255) ~~~ # EXPECTED -NIL +MODULE NOT FOUND - nominal_tag_package_import.md:2:1:2:26 # PROBLEMS -NIL +**MODULE NOT FOUND** +The module `styles.Color` was not found in this Roc project. + +You're attempting to use this module here: +**nominal_tag_package_import.md:2:1:2:26:** +```roc +import styles.Color as CC +``` +^^^^^^^^^^^^^^^^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent,KwAs,UpperIdent, diff --git a/test/snapshots/nominal_type_origin_mismatch.md b/test/snapshots/nominal_type_origin_mismatch.md index c1e1a261d7..37c3e0b667 100644 --- a/test/snapshots/nominal_type_origin_mismatch.md +++ b/test/snapshots/nominal_type_origin_mismatch.md @@ -15,9 +15,21 @@ main = expectsPerson("not a person") ~~~ # EXPECTED +MODULE NOT FOUND - nominal_type_origin_mismatch.md:1:1:1:30 UNDECLARED TYPE - nominal_type_origin_mismatch.md:3:17:3:23 UNUSED VARIABLE - nominal_type_origin_mismatch.md:4:18:4:19 # PROBLEMS +**MODULE NOT FOUND** +The module `Data` was not found in this Roc project. + +You're attempting to use this module here: +**nominal_type_origin_mismatch.md:1:1:1:30:** +```roc +import Data exposing [Person] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDECLARED TYPE** The type _Person_ is not declared in this scope. diff --git a/test/snapshots/primitive/stmt_import.md b/test/snapshots/primitive/stmt_import.md index 8c177bfeed..93a390f418 100644 --- a/test/snapshots/primitive/stmt_import.md +++ b/test/snapshots/primitive/stmt_import.md @@ -12,6 +12,7 @@ PARSE ERROR - stmt_import.md:1:18:1:19 PARSE ERROR - stmt_import.md:1:19:1:22 PARSE ERROR - stmt_import.md:1:22:1:23 PARSE ERROR - stmt_import.md:1:27:1:28 +MODULE NOT FOUND - stmt_import.md:1:1:1:17 # PROBLEMS **PARSE ERROR** A parsing error occurred: `statement_unexpected_token` @@ -69,6 +70,17 @@ import json.Json [foo, BAR] ^ +**MODULE NOT FOUND** +The module `json.Json` was not found in this Roc project. + +You're attempting to use this module here: +**stmt_import.md:1:1:1:17:** +```roc +import json.Json [foo, BAR] +``` +^^^^^^^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent,OpenSquare,LowerIdent,Comma,UpperIdent,CloseSquare, diff --git a/test/snapshots/pure_annotation_effectful_body_error.md b/test/snapshots/pure_annotation_effectful_body_error.md index dc547bb4e1..e6e8fe4d21 100644 --- a/test/snapshots/pure_annotation_effectful_body_error.md +++ b/test/snapshots/pure_annotation_effectful_body_error.md @@ -16,8 +16,20 @@ bad_function = |msg| Stdout.line!(msg) main! = bad_function("This should fail") ~~~ # EXPECTED +MODULE NOT FOUND - pure_annotation_effectful_body_error.md:3:1:3:17 UNDEFINED VARIABLE - pure_annotation_effectful_body_error.md:7:22:7:34 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**pure_annotation_effectful_body_error.md:3:1:3:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `line!` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/qualified_type_canonicalization.md b/test/snapshots/qualified_type_canonicalization.md index 55a0ea0b4b..8dfed85a99 100644 --- a/test/snapshots/qualified_type_canonicalization.md +++ b/test/snapshots/qualified_type_canonicalization.md @@ -53,6 +53,9 @@ transform = |result| # EXPECTED PARSE ERROR - qualified_type_canonicalization.md:8:1:8:7 PARSE ERROR - qualified_type_canonicalization.md:8:14:8:18 +MODULE NOT FOUND - qualified_type_canonicalization.md:9:1:9:13 +MODULE NOT FOUND - qualified_type_canonicalization.md:10:1:10:40 +MODULE NOT FOUND - qualified_type_canonicalization.md:11:1:11:32 UNDECLARED TYPE - qualified_type_canonicalization.md:15:19:15:24 MODULE NOT IMPORTED - qualified_type_canonicalization.md:22:23:22:44 DOES NOT EXIST - qualified_type_canonicalization.md:23:23:23:32 @@ -101,6 +104,39 @@ import Basics.Try ^^^^ +**MODULE NOT FOUND** +The module `Color` was not found in this Roc project. + +You're attempting to use this module here: +**qualified_type_canonicalization.md:9:1:9:13:** +```roc +import Color +``` +^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `ModuleB` was not found in this Roc project. + +You're attempting to use this module here: +**qualified_type_canonicalization.md:10:1:10:40:** +```roc +import ModuleA.ModuleB exposing [TypeC] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `ExternalModule` was not found in this Roc project. + +You're attempting to use this module here: +**qualified_type_canonicalization.md:11:1:11:32:** +```roc +import ExternalModule as ExtMod +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **UNDECLARED TYPE** The type _Color_ is not declared in this scope. diff --git a/test/snapshots/simple_module_no_blanks.md b/test/snapshots/simple_module_no_blanks.md index 7da6a3bf94..70e3b05b10 100644 --- a/test/snapshots/simple_module_no_blanks.md +++ b/test/snapshots/simple_module_no_blanks.md @@ -10,8 +10,20 @@ hello! = Stdout.line!("Hello") world = "World" ~~~ # EXPECTED +MODULE NOT FOUND - simple_module_no_blanks.md:1:1:1:17 UNDEFINED VARIABLE - simple_module_no_blanks.md:2:10:2:22 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**simple_module_no_blanks.md:1:1:1:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `line!` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/syntax_grab_bag.md b/test/snapshots/syntax_grab_bag.md index be83b473dc..c1f25faf45 100644 --- a/test/snapshots/syntax_grab_bag.md +++ b/test/snapshots/syntax_grab_bag.md @@ -224,7 +224,12 @@ UNDECLARED TYPE - syntax_grab_bag.md:45:8:45:10 UNDECLARED TYPE - syntax_grab_bag.md:46:8:46:17 UNDECLARED TYPE - syntax_grab_bag.md:52:4:52:6 UNDECLARED TYPE - syntax_grab_bag.md:53:8:53:17 +MODULE NOT FOUND - syntax_grab_bag.md:4:1:4:42 NOT IMPLEMENTED - :0:0:0:0 +MODULE NOT FOUND - syntax_grab_bag.md:6:1:12:4 +MODULE NOT FOUND - syntax_grab_bag.md:14:1:14:82 +MODULE NOT FOUND - syntax_grab_bag.md:16:1:16:27 +MODULE NOT FOUND - syntax_grab_bag.md:17:1:20:20 UNDEFINED VARIABLE - syntax_grab_bag.md:72:4:72:13 UNUSED VARIABLE - syntax_grab_bag.md:97:3:97:8 UNUSED VARIABLE - syntax_grab_bag.md:1:1:1:1 @@ -377,11 +382,73 @@ This type is referenced here: ^^^^^^^^^ +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**syntax_grab_bag.md:4:1:4:42:** +```roc +import pf.Stdout exposing [line!, write!] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + **NOT IMPLEMENTED** This feature is not yet implemented: malformed import module name contains invalid control characters This error doesn't have a proper diagnostic report yet. Let us know if you want to help improve Roc's error messages! +**MODULE NOT FOUND** +The module `MALFORMED_IMPORT` was not found in this Roc project. + +You're attempting to use this module here: +**syntax_grab_bag.md:6:1:12:4:** +```roc +import # Comment after import keyword + pf # Comment after qualifier + .StdoutMultiline # Comment after ident + exposing [ # Comment after exposing open + line!, # Comment after exposed item + write!, # Another after exposed item + ] # Comment after exposing close +``` + + +**MODULE NOT FOUND** +The module `pkg.Something` was not found in this Roc project. + +You're attempting to use this module here: +**syntax_grab_bag.md:14:1:14:82:** +```roc +import pkg.Something exposing [func as function, Type as ValueCategory, Custom.*] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `BadName` was not found in this Roc project. + +You're attempting to use this module here: +**syntax_grab_bag.md:16:1:16:27:** +```roc +import BadName as GoodName +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +**MODULE NOT FOUND** +The module `BadNameMultiline` was not found in this Roc project. + +You're attempting to use this module here: +**syntax_grab_bag.md:17:1:20:20:** +```roc +import + BadNameMultiline + as + GoodNameMultiline +``` + + **UNDEFINED VARIABLE** Nothing is named `some_func` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/type_record_effectful.md b/test/snapshots/type_record_effectful.md index 7c97c0791f..b745a9a2ce 100644 --- a/test/snapshots/type_record_effectful.md +++ b/test/snapshots/type_record_effectful.md @@ -17,8 +17,20 @@ printName = |person| { main! = |_| {} ~~~ # EXPECTED +MODULE NOT FOUND - type_record_effectful.md:3:1:3:17 UNDEFINED VARIABLE - type_record_effectful.md:7:5:7:17 # PROBLEMS +**MODULE NOT FOUND** +The module `pf.Stdout` was not found in this Roc project. + +You're attempting to use this module here: +**type_record_effectful.md:3:1:3:17:** +```roc +import pf.Stdout +``` +^^^^^^^^^^^^^^^^ + + **UNDEFINED VARIABLE** Nothing is named `line!` in this scope. Is there an `import` or `exposing` missing up-top? diff --git a/test/snapshots/where_clause/where_clauses_10.md b/test/snapshots/where_clause/where_clauses_10.md index 676d5ee7e0..5a840f7616 100644 --- a/test/snapshots/where_clause/where_clauses_10.md +++ b/test/snapshots/where_clause/where_clauses_10.md @@ -14,9 +14,19 @@ decode_things # After member name [a.Decode] ~~~ # EXPECTED -NIL +MODULE NOT FOUND - where_clauses_10.md:1:1:1:32 # PROBLEMS -NIL +**MODULE NOT FOUND** +The module `Decode` was not found in this Roc project. + +You're attempting to use this module here: +**where_clauses_10.md:1:1:1:32:** +```roc +import Decode exposing [Decode] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,UpperIdent,KwExposing,OpenSquare,UpperIdent,CloseSquare, diff --git a/test/snapshots/where_clause/where_clauses_4.md b/test/snapshots/where_clause/where_clauses_4.md index e01e05397e..10f191b02b 100644 --- a/test/snapshots/where_clause/where_clauses_4.md +++ b/test/snapshots/where_clause/where_clauses_4.md @@ -12,9 +12,19 @@ decodeThings : List(List(U8)) -> List(a) decodeThings = ... ~~~ # EXPECTED -NIL +MODULE NOT FOUND - where_clauses_4.md:1:1:1:32 # PROBLEMS -NIL +**MODULE NOT FOUND** +The module `Decode` was not found in this Roc project. + +You're attempting to use this module here: +**where_clauses_4.md:1:1:1:32:** +```roc +import Decode exposing [Decode] +``` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + # TOKENS ~~~zig KwImport,UpperIdent,KwExposing,OpenSquare,UpperIdent,CloseSquare,