From 3a144a304ae3e987ce5f37fbc7761ba8ce9e34ed Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 17 Nov 2025 16:48:40 -0500 Subject: [PATCH] Fix parallel execution --- src/check/test/unify_test.zig | 23 +++-- src/check/unify.zig | 8 +- src/compile/compile_package.zig | 6 +- src/snapshot_tool/main.zig | 68 ++++++++++--- test/snapshots/add_var_with_spaces.md | 11 --- .../binop_omnibus__single__no_spaces.md | 90 ++++++++++++++++++ test/snapshots/can_import_comprehensive.md | 38 -------- test/snapshots/can_import_exposing_types.md | 4 +- test/snapshots/can_import_type_annotations.md | 19 +--- .../can_import_unresolved_qualified.md | 55 ----------- test/snapshots/can_import_with_alias.md | 11 --- test/snapshots/can_list_multiline_mismatch.md | 75 +++++++++++++++ .../can_list_nested_heterogeneous.md | 67 +++++++++++++ test/snapshots/default_app_no_main.md | 17 +--- test/snapshots/default_app_wrong_arity.md | 16 ---- .../effectful_with_effectful_annotation.md | 11 --- test/snapshots/fuzz_crash/fuzz_crash_001.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_002.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_003.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_004.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_005.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_006.md | Bin 1949 -> 1677 bytes test/snapshots/fuzz_crash/fuzz_crash_007.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_008.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_009.md | 19 ---- test/snapshots/fuzz_crash/fuzz_crash_010.md | 18 ---- test/snapshots/fuzz_crash/fuzz_crash_012.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_013.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_014.md | 16 ---- test/snapshots/fuzz_crash/fuzz_crash_015.md | 17 ---- test/snapshots/fuzz_crash/fuzz_crash_016.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_017.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_018.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_021.md | 18 ---- test/snapshots/fuzz_crash/fuzz_crash_027.md | 18 ---- test/snapshots/fuzz_crash/fuzz_crash_031.md | 17 ---- test/snapshots/fuzz_crash/fuzz_crash_038.md | 15 --- test/snapshots/fuzz_crash/fuzz_crash_064.md | 17 +--- test/snapshots/fuzz_crash/fuzz_crash_079.md | 17 +--- test/snapshots/fuzz_crash/fuzz_hang_001.md | 15 --- .../if_then_else/if_then_else_simple_file.md | 14 --- test/snapshots/import_exposing_basic.md | 15 --- test/snapshots/lambda_multi_arg_mismatch.md | 19 ---- ...nominal_associated_lookup_in_containers.md | 4 +- .../nominal/nominal_associated_vs_module.md | 24 +---- test/snapshots/plume_package/Color.md | 31 +----- .../records/statement_record_destructure.md | 11 --- test/snapshots/some_folder/002.md | 18 ---- test/snapshots/type_app_complex_nested.md | 26 +---- test/snapshots/type_app_multiple_args.md | 11 --- test/snapshots/type_app_nested.md | 4 +- test/snapshots/type_comprehensive_scope.md | 10 ++ test/snapshots/type_module/WrongName.md | 19 +--- test/snapshots/type_module/no_type_no_main.md | 17 +--- test/snapshots/type_tag_union_basic.md | 8 +- test/snapshots/type_tag_union_complex.md | 4 +- test/snapshots/type_var_nested.md | 8 +- 57 files changed, 346 insertions(+), 783 deletions(-) diff --git a/src/check/test/unify_test.zig b/src/check/test/unify_test.zig index 9e5a6df85c..c15fbe42ca 100644 --- a/src/check/test/unify_test.zig +++ b/src/check/test/unify_test.zig @@ -2995,20 +2995,19 @@ test "unify - fails on anonymous recursion" { var env = try TestEnv.init(gpa); defer env.deinit(); - // Use Box for anonymous recursion testing - const box_var_a = try env.module_env.types.fresh(); - const box_content_a = Content{ - .structure = .{ .box = box_var_a }, - }; - try env.module_env.types.setRootVarContent(box_var_a, box_content_a); + // Create a tag union that recursively contains itself (anonymous recursion) + // This is like: a = [A a] unifying with b = [A b] + const tag_var_a = try env.module_env.types.fresh(); + const tag_a = try env.mkTag("A", &[_]Var{tag_var_a}); + const tag_union_a = try env.mkTagUnionClosed(&[_]Tag{tag_a}); + try env.module_env.types.setRootVarContent(tag_var_a, tag_union_a.content); - const box_var_b = try env.module_env.types.fresh(); - const box_content_b = Content{ - .structure = .{ .box = box_var_b }, - }; - try env.module_env.types.setRootVarContent(box_var_b, box_content_b); + const tag_var_b = try env.module_env.types.fresh(); + const tag_b = try env.mkTag("A", &[_]Var{tag_var_b}); + const tag_union_b = try env.mkTagUnionClosed(&[_]Tag{tag_b}); + try env.module_env.types.setRootVarContent(tag_var_b, tag_union_b.content); - const result = try env.unify(box_var_a, box_var_b); + const result = try env.unify(tag_var_a, tag_var_b); switch (result) { .ok => try std.testing.expect(false), diff --git a/src/check/unify.zig b/src/check/unify.zig index 9bdff744f6..3b184683a7 100644 --- a/src/check/unify.zig +++ b/src/check/unify.zig @@ -1476,11 +1476,9 @@ const Unifier = struct { }) catch return error.AllocatorError; // Create nominal List(U8) - List is from Builtin module - const list_ident = self.module_env.common.findIdent("List") orelse { - // If List ident is not found, something is wrong with the environment - // This should never happen in a properly initialized compiler - @panic("List ident not found in module environment"); - }; + // If List ident is not found, something is wrong with the environment + // This should never happen in a properly initialized compiler! + const list_ident = self.module_env.common.findIdent("List") orelse unreachable; // Use the cached builtin_module_ident which represents the "Builtin" module. const origin_module = if (self.module_lookup.get(self.module_env.builtin_module_ident)) |_| diff --git a/src/compile/compile_package.zig b/src/compile/compile_package.zig index b712440011..c737ca59fe 100644 --- a/src/compile/compile_package.zig +++ b/src/compile/compile_package.zig @@ -766,6 +766,7 @@ pub const PackageEnv = struct { /// Combined canonicalization and type checking function for snapshot tool /// This ensures the SAME module_envs map is used for both phases + /// Note: Does NOT run compile-time evaluation - caller should do that separately if needed pub fn canonicalizeAndTypeCheckModule( gpa: Allocator, env: *ModuleEnv, @@ -815,11 +816,6 @@ pub const PackageEnv = struct { try checker.checkFile(); - // After type checking, evaluate top-level declarations at compile time - const builtin_types_for_eval = BuiltinTypes.init(builtin_indices, builtin_module_env, builtin_module_env, builtin_module_env); - var comptime_evaluator = try eval.ComptimeEvaluator.init(gpa, env, imported_envs, &checker.problems, builtin_types_for_eval); - _ = try comptime_evaluator.evalAll(); - module_envs_map.deinit(); return checker; diff --git a/src/snapshot_tool/main.zig b/src/snapshot_tool/main.zig index f738c434e4..fd6c51f23b 100644 --- a/src/snapshot_tool/main.zig +++ b/src/snapshot_tool/main.zig @@ -1143,9 +1143,23 @@ fn processSnapshotContent( var maybe_expr_idx: ?Can.CanonicalizedExpr = null; switch (content.meta.node_type) { - .file, .package, .platform, .app, .snippet => { + .file, .package, .platform, .app => { // All file types that use canonicalizeFile() will use the combined function below }, + .snippet => { + // Snippet tests can have arbitrary content (type declarations, expressions, etc.) + // that may not work with canonicalizeFile(), so handle them separately + var module_envs = std.AutoHashMap(base.Ident.Idx, Can.AutoImportedType).init(allocator); + defer module_envs.deinit(); + + if (config.builtin_module) |builtin_env| { + try Can.populateModuleEnvs(&module_envs, can_ir, builtin_env, config.builtin_indices); + } + + var czer = try Can.init(can_ir, &parse_ast, &module_envs); + defer czer.deinit(); + try czer.canonicalizeFile(); + }, .header => { // TODO: implement canonicalize_header when available }, @@ -1244,20 +1258,44 @@ fn processSnapshotContent( ); _ = try checker.checkExprRepl(expr_idx.idx); break :blk checker; - } else blk: { - // For all test types that use canonicalizeFile() (file, package, platform, app, snippet), - // use the combined canonicalize+typecheck function. - // This ensures the SAME module_envs map is used for both phases (just like REPL tests) - const builtin_env = config.builtin_module orelse unreachable; - const imported_envs_const: []const *ModuleEnv = @ptrCast(builtin_modules.items); - break :blk try compile.PackageEnv.canonicalizeAndTypeCheckModule( - allocator, - can_ir, - &parse_ast, - builtin_env, - config.builtin_indices, - imported_envs_const, - ); + } else switch (content.meta.node_type) { + .file, .package, .platform, .app => blk: { + // For file types, use the combined canonicalize+typecheck function. + // This ensures the SAME module_envs map is used for both phases (just like REPL tests) + const builtin_env = config.builtin_module orelse unreachable; + const imported_envs_const: []const *ModuleEnv = @ptrCast(builtin_modules.items); + break :blk try compile.PackageEnv.canonicalizeAndTypeCheckModule( + allocator, + can_ir, + &parse_ast, + builtin_env, + config.builtin_indices, + imported_envs_const, + ); + }, + .snippet, .statement, .header, .expr => blk: { + // For snippet/statement/header/expr tests, use old-style separate type checking (already canonicalized above) + // Note: .expr can reach here if canonicalizeExpr returned null (error during canonicalization) + var module_envs = std.AutoHashMap(base.Ident.Idx, Can.AutoImportedType).init(allocator); + defer module_envs.deinit(); + + if (config.builtin_module) |builtin_env| { + try Can.populateModuleEnvs(&module_envs, can_ir, builtin_env, config.builtin_indices); + } + + var checker = try Check.init( + allocator, + &can_ir.types, + can_ir, + builtin_modules.items, + &module_envs, + &can_ir.store.regions, + common_idents, + ); + try checker.checkFile(); + break :blk checker; + }, + .repl => unreachable, // Should never reach here - repl is handled earlier }; defer solver.deinit(); diff --git a/test/snapshots/add_var_with_spaces.md b/test/snapshots/add_var_with_spaces.md index d582010db7..f9425bfc37 100644 --- a/test/snapshots/add_var_with_spaces.md +++ b/test/snapshots/add_var_with_spaces.md @@ -21,17 +21,6 @@ add2 = x + 2 ^ -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**add_var_with_spaces.md:1:8:1:18:** -```roc -add2 = x + 2 -``` - ^^^^^^^^^^ - -The `crash` happened with this message: - **runtime error** - # TOKENS ~~~zig LowerIdent,OpAssign,LowerIdent,OpPlus,Int, diff --git a/test/snapshots/binop_omnibus__single__no_spaces.md b/test/snapshots/binop_omnibus__single__no_spaces.md index e69de29bb2..2e8172c6f7 100644 --- a/test/snapshots/binop_omnibus__single__no_spaces.md +++ b/test/snapshots/binop_omnibus__single__no_spaces.md @@ -0,0 +1,90 @@ +# META +~~~ini +description=Binop omnibus - singleline - no spaces +type=expr +~~~ +# SOURCE +~~~roc +Err(foo)??12>5*5 or 13+2<5 and 10-1>=16 or 12<=3/5 +~~~ +# EXPECTED +UNDEFINED VARIABLE - binop_omnibus__single__no_spaces.md:1:5:1:8 +INVALID BOOL OPERATION - binop_omnibus__single__no_spaces.md:1:21:1:21 +# PROBLEMS +**UNDEFINED VARIABLE** +Nothing is named `foo` in this scope. +Is there an `import` or `exposing` missing up-top? + +**binop_omnibus__single__no_spaces.md:1:5:1:8:** +```roc +Err(foo)??12>5*5 or 13+2<5 and 10-1>=16 or 12<=3/5 +``` + ^^^ + + +**INVALID BOOL OPERATION** +I'm having trouble with this bool operation: +**binop_omnibus__single__no_spaces.md:1:21:** +```roc +Err(foo)??12>5*5 or 13+2<5 and 10-1>=16 or 12<=3/5 +``` + ^^ + +Both sides of `and` must be _Bool_ values, but the right side is: + _Num(_size)_ + +Note: Roc does not have "truthiness" where other values like strings, numbers or lists are automatically converted to bools. You must do that conversion yourself! + +# TOKENS +~~~zig +UpperIdent,NoSpaceOpenRound,LowerIdent,CloseRound,OpDoubleQuestion,Int,OpGreaterThan,Int,OpStar,Int,OpOr,Int,OpPlus,Int,OpLessThan,Int,OpAnd,Int,Int,OpGreaterThanOrEq,Int,OpOr,Int,OpLessThanOrEq,Int,OpSlash,Int, +EndOfFile, +~~~ +# PARSE +~~~clojure +(e-binop (op "or") + (e-binop (op ">") + (e-binop (op "??") + (e-apply + (e-tag (raw "Err")) + (e-ident (raw "foo"))) + (e-int (raw "12"))) + (e-binop (op "*") + (e-int (raw "5")) + (e-int (raw "5")))) + (e-binop (op "and") + (e-binop (op "<") + (e-binop (op "+") + (e-int (raw "13")) + (e-int (raw "2"))) + (e-int (raw "5"))) + (e-int (raw "10")))) +~~~ +# FORMATTED +~~~roc +Err(foo) ?? 12 > 5 * 5 or 13 + 2 < 5 and 10 +~~~ +# CANONICALIZE +~~~clojure +(e-binop (op "or") + (e-binop (op "gt") + (e-binop (op "null_coalesce") + (e-tag (name "Err") + (args + (e-runtime-error (tag "ident_not_in_scope")))) + (e-num (value "12"))) + (e-binop (op "mul") + (e-num (value "5")) + (e-num (value "5")))) + (e-binop (op "and") + (e-binop (op "lt") + (e-binop (op "add") + (e-num (value "13")) + (e-num (value "2"))) + (e-num (value "5"))) + (e-num (value "10")))) +~~~ +# TYPES +~~~clojure +(expr (type "Error")) +~~~ diff --git a/test/snapshots/can_import_comprehensive.md b/test/snapshots/can_import_comprehensive.md index a11055c2f0..c8b914a426 100644 --- a/test/snapshots/can_import_comprehensive.md +++ b/test/snapshots/can_import_comprehensive.md @@ -192,44 +192,6 @@ Is there an `import` or `exposing` missing up-top? ^^^^^^^^^^ -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**can_import_comprehensive.md:5:8:33:2:** -```roc -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, - ) -} -``` - -The `crash` happened with this message: - **runtime error** - # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent, diff --git a/test/snapshots/can_import_exposing_types.md b/test/snapshots/can_import_exposing_types.md index 8238ca1a8c..83cb468eeb 100644 --- a/test/snapshots/can_import_exposing_types.md +++ b/test/snapshots/can_import_exposing_types.md @@ -957,7 +957,7 @@ combineTrys = |jsonTry, httpStatus| (patt (type "Error, List(Error) -> Error")) (patt (type "Error -> Error")) (patt (type "Error -> Error")) - (patt (type "Error, Error -> Error"))) + (patt (type "Try(Error, Error), Error -> Try(Error, Error)"))) (type_decls (alias (type "ServerConfig") (ty-header (name "ServerConfig")))) @@ -967,5 +967,5 @@ combineTrys = |jsonTry, httpStatus| (expr (type "Error, List(Error) -> Error")) (expr (type "Error -> Error")) (expr (type "Error -> Error")) - (expr (type "Error, Error -> Error")))) + (expr (type "Try(Error, Error), Error -> Try(Error, Error)")))) ~~~ diff --git a/test/snapshots/can_import_type_annotations.md b/test/snapshots/can_import_type_annotations.md index 6a416f54de..9edb6b6ee1 100644 --- a/test/snapshots/can_import_type_annotations.md +++ b/test/snapshots/can_import_type_annotations.md @@ -233,17 +233,6 @@ advancedParser = |parserConfig, input| Json.Parser.parseWith(parserConfig, input ^^^^^^^^^^^^^^^^^^^^^ -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**can_import_type_annotations.md:21:10:21:28:** -```roc -config = Json.defaultConfig -``` - ^^^^^^^^^^^^^^^^^^ - -The `crash` happened with this message: - **Runtime error in expression** - # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent,KwAs,UpperIdent,KwExposing,OpenSquare,UpperIdent,Comma,UpperIdent,CloseSquare, @@ -655,15 +644,15 @@ combineTrys = |result1, result2| (defs (patt (type "Error -> Error")) (patt (type "Str -> Error")) - (patt (type "Error -> Error")) + (patt (type "Error -> Try(Error, Error)")) (patt (type "Error")) (patt (type "Error, Str -> Error")) - (patt (type "Error, Error -> Error"))) + (patt (type "Try(a, err), Try(b, err) -> Try((a, b), err)"))) (expressions (expr (type "Error -> Error")) (expr (type "Str -> Error")) - (expr (type "Error -> Error")) + (expr (type "Error -> Try(Error, Error)")) (expr (type "Error")) (expr (type "Error, Str -> Error")) - (expr (type "Error, Error -> Error")))) + (expr (type "Try(a, err), Try(b, err) -> Try((a, b), err)")))) ~~~ diff --git a/test/snapshots/can_import_unresolved_qualified.md b/test/snapshots/can_import_unresolved_qualified.md index aa19bf7411..25ff2522eb 100644 --- a/test/snapshots/can_import_unresolved_qualified.md +++ b/test/snapshots/can_import_unresolved_qualified.md @@ -177,61 +177,6 @@ parser = Json.Parser.Advanced.NonExistent.create ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**can_import_unresolved_qualified.md:5:8:5:31:** -```roc -main = Json.NonExistent.method -``` - ^^^^^^^^^^^^^^^^^^^^^^^ - -The `crash` happened with this message: - **Runtime error in expression** - -**COMPTIME EVAL ERROR** -This definition could not be evaluated at compile time: -**can_import_unresolved_qualified.md:16:10:16:28:** -```roc -result = Json.prase("test") -``` - ^^^^^^^^^^^^^^^^^^ - -The evaluation failed with error: - **TypeMismatch** - -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**can_import_unresolved_qualified.md:19:10:19:31:** -```roc -config = Unknown.Module.config -``` - ^^^^^^^^^^^^^^^^^^^^^ - -The `crash` happened with this message: - **Runtime error in expression** - -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**can_import_unresolved_qualified.md:22:10:22:28:** -```roc -client = Http.invalidMethod -``` - ^^^^^^^^^^^^^^^^^^ - -The `crash` happened with this message: - **Runtime error in expression** - -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**can_import_unresolved_qualified.md:25:10:25:49:** -```roc -parser = Json.Parser.Advanced.NonExistent.create -``` - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The `crash` happened with this message: - **Runtime error in expression** - # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent, diff --git a/test/snapshots/can_import_with_alias.md b/test/snapshots/can_import_with_alias.md index b41710335e..ddf5b8a9fb 100644 --- a/test/snapshots/can_import_with_alias.md +++ b/test/snapshots/can_import_with_alias.md @@ -35,17 +35,6 @@ main = MyJson.decode ^^^^^^^^^^^^^ -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**can_import_with_alias.md:3:8:3:21:** -```roc -main = MyJson.decode -``` - ^^^^^^^^^^^^^ - -The `crash` happened with this message: - **Runtime error in expression** - # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent,KwAs,UpperIdent, diff --git a/test/snapshots/can_list_multiline_mismatch.md b/test/snapshots/can_list_multiline_mismatch.md index e69de29bb2..bbcb3759fd 100644 --- a/test/snapshots/can_list_multiline_mismatch.md +++ b/test/snapshots/can_list_multiline_mismatch.md @@ -0,0 +1,75 @@ +# META +~~~ini +description=Multiline list with type mismatch +type=expr +~~~ +# SOURCE +~~~roc +[ + 42, + "hello world", + 100 +] +~~~ +# EXPECTED +INCOMPATIBLE LIST ELEMENTS - can_list_multiline_mismatch.md:2:5:2:5 +# PROBLEMS +**INCOMPATIBLE LIST ELEMENTS** +The first two elements in this list have incompatible types: +**can_list_multiline_mismatch.md:2:5:** +```roc + 42, + "hello world", +``` + ^^ + ^^^^^^^^^^^^^ + +The first element has this type: + _Num(_size)_ + +However, the second element has this type: + _Str_ + +All elements in a list must have compatible types. + +Note: You can wrap each element in a tag to make them compatible. +To learn about tags, see + +# TOKENS +~~~zig +OpenSquare, +Int,Comma, +StringStart,StringPart,StringEnd,Comma, +Int, +CloseSquare, +EndOfFile, +~~~ +# PARSE +~~~clojure +(e-list + (e-int (raw "42")) + (e-string + (e-string-part (raw "hello world"))) + (e-int (raw "100"))) +~~~ +# FORMATTED +~~~roc +[ + 42, + "hello world", + 100, +] +~~~ +# CANONICALIZE +~~~clojure +(e-list + (elems + (e-num (value "42")) + (e-string + (e-literal (string "hello world"))) + (e-num (value "100")))) +~~~ +# TYPES +~~~clojure +(expr (type "List(Error)")) +~~~ diff --git a/test/snapshots/can_list_nested_heterogeneous.md b/test/snapshots/can_list_nested_heterogeneous.md index e69de29bb2..8d11468cb9 100644 --- a/test/snapshots/can_list_nested_heterogeneous.md +++ b/test/snapshots/can_list_nested_heterogeneous.md @@ -0,0 +1,67 @@ +# META +~~~ini +description=Heterogeneous nested list causes type mismatch +type=expr +~~~ +# SOURCE +~~~roc +[[], [1], ["hello"]] +~~~ +# EXPECTED +INCOMPATIBLE LIST ELEMENTS - can_list_nested_heterogeneous.md:1:6:1:6 +# PROBLEMS +**INCOMPATIBLE LIST ELEMENTS** +The second and third elements in this list have incompatible types: +**can_list_nested_heterogeneous.md:1:6:** +```roc +[[], [1], ["hello"]] +``` + ^^^ ^^^^^^^^^ + +The second element has this type: + _List(Num(_size))_ + +However, the third element has this type: + _List(Str)_ + +All elements in a list must have compatible types. + +Note: You can wrap each element in a tag to make them compatible. +To learn about tags, see + +# TOKENS +~~~zig +OpenSquare,OpenSquare,CloseSquare,Comma,OpenSquare,Int,CloseSquare,Comma,OpenSquare,StringStart,StringPart,StringEnd,CloseSquare,CloseSquare, +EndOfFile, +~~~ +# PARSE +~~~clojure +(e-list + (e-list) + (e-list + (e-int (raw "1"))) + (e-list + (e-string + (e-string-part (raw "hello"))))) +~~~ +# FORMATTED +~~~roc +NO CHANGE +~~~ +# CANONICALIZE +~~~clojure +(e-list + (elems + (e-empty_list) + (e-list + (elems + (e-num (value "1")))) + (e-list + (elems + (e-string + (e-literal (string "hello"))))))) +~~~ +# TYPES +~~~clojure +(expr (type "List(Error)")) +~~~ diff --git a/test/snapshots/default_app_no_main.md b/test/snapshots/default_app_no_main.md index 15d7e4698e..e81c0c5766 100644 --- a/test/snapshots/default_app_no_main.md +++ b/test/snapshots/default_app_no_main.md @@ -8,22 +8,9 @@ type=file helper = |x| x + 1 ~~~ # EXPECTED -MISSING MAIN! FUNCTION - default_app_no_main.md:1:1:1:19 +NIL # PROBLEMS -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**default_app_no_main.md:1:1:1:19:** -```roc -helper = |x| x + 1 -``` -^^^^^^^^^^^^^^^^^^ - - +NIL # TOKENS ~~~zig LowerIdent,OpAssign,OpBar,LowerIdent,OpBar,LowerIdent,OpPlus,Int, diff --git a/test/snapshots/default_app_wrong_arity.md b/test/snapshots/default_app_wrong_arity.md index 39261fbf76..589e0ba169 100644 --- a/test/snapshots/default_app_wrong_arity.md +++ b/test/snapshots/default_app_wrong_arity.md @@ -11,7 +11,6 @@ main! = |arg1, arg2| { ~~~ # EXPECTED UNUSED VARIABLE - default_app_wrong_arity.md:1:16:1:20 -MAIN! SHOULD TAKE 1 ARGUMENT - default_app_wrong_arity.md:1:1:3:2 # PROBLEMS **UNUSED VARIABLE** Variable `arg2` is not used anywhere in your code. @@ -25,21 +24,6 @@ main! = |arg1, arg2| { ^^^^ -**MAIN! SHOULD TAKE 1 ARGUMENT** -`main!` is defined but has the wrong number of arguments. `main!` should take 1 argument. - -Found `2` arguments. - -Change it to: -`main! = |arg| { ... }` -**default_app_wrong_arity.md:1:1:3:2:** -```roc -main! = |arg1, arg2| { - arg1 -} -``` - - # TOKENS ~~~zig LowerIdent,OpAssign,OpBar,LowerIdent,Comma,LowerIdent,OpBar,OpenCurly, diff --git a/test/snapshots/effectful_with_effectful_annotation.md b/test/snapshots/effectful_with_effectful_annotation.md index 9a2243942b..a1e192abb1 100644 --- a/test/snapshots/effectful_with_effectful_annotation.md +++ b/test/snapshots/effectful_with_effectful_annotation.md @@ -41,17 +41,6 @@ print_msg! = |msg| Stdout.line!(msg) ^^^^^^^^^^^^ -**COMPTIME EVAL ERROR** -This definition could not be evaluated at compile time: -**effectful_with_effectful_annotation.md:9:9:9:36:** -```roc -main! = print_msg!("Hello, world!") -``` - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The evaluation failed with error: - **TypeMismatch** - # TOKENS ~~~zig KwApp,OpenSquare,LowerIdent,CloseSquare,OpenCurly,LowerIdent,OpColon,KwPlatform,StringStart,StringPart,StringEnd,CloseCurly, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_001.md b/test/snapshots/fuzz_crash/fuzz_crash_001.md index fd3d64f36a..fdd98cc867 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_001.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_001.md @@ -11,7 +11,6 @@ mo|% PARSE ERROR - fuzz_crash_001.md:1:1:1:3 PARSE ERROR - fuzz_crash_001.md:1:3:1:4 PARSE ERROR - fuzz_crash_001.md:1:4:1:5 -MISSING MAIN! FUNCTION - fuzz_crash_001.md:1:1:1:5 # PROBLEMS **PARSE ERROR** A parsing error occurred: `statement_unexpected_token` @@ -46,20 +45,6 @@ mo|% ^ -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**fuzz_crash_001.md:1:1:1:5:** -```roc -mo|% -``` -^^^^ - - # TOKENS ~~~zig LowerIdent,OpBar,OpPercent, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_002.md b/test/snapshots/fuzz_crash/fuzz_crash_002.md index 80cba11734..554ca47c81 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_002.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_002.md @@ -20,7 +20,6 @@ PARSE ERROR - fuzz_crash_002.md:1:21:1:23 PARSE ERROR - fuzz_crash_002.md:1:23:1:24 PARSE ERROR - fuzz_crash_002.md:1:24:1:25 MALFORMED TYPE - fuzz_crash_002.md:1:6:1:7 -MISSING MAIN! FUNCTION - fuzz_crash_002.md:1:1:1:25 # PROBLEMS **UNEXPECTED TOKEN IN TYPE ANNOTATION** The token **;** is not expected in a type annotation. @@ -153,20 +152,6 @@ modu:;::::::::::::::le[% ^ -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**fuzz_crash_002.md:1:1:1:25:** -```roc -modu:;::::::::::::::le[% -``` -^^^^^^^^^^^^^^^^^^^^^^^^ - - # TOKENS ~~~zig LowerIdent,OpColon,MalformedUnknownToken,OpDoubleColon,OpDoubleColon,OpDoubleColon,OpDoubleColon,OpDoubleColon,OpDoubleColon,OpDoubleColon,LowerIdent,OpenSquare,OpPercent, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_003.md b/test/snapshots/fuzz_crash/fuzz_crash_003.md index 2772e7bdc4..e95b750762 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_003.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_003.md @@ -13,7 +13,6 @@ PARSE ERROR - fuzz_crash_003.md:1:1:1:2 PARSE ERROR - fuzz_crash_003.md:1:3:1:4 PARSE ERROR - fuzz_crash_003.md:1:4:1:6 PARSE ERROR - fuzz_crash_003.md:1:6:1:6 -MISSING MAIN! FUNCTION - fuzz_crash_003.md:1:1:1:6 # PROBLEMS **UNCLOSED STRING** This string is missing a closing quote. @@ -69,20 +68,6 @@ This is an unexpected parsing error. Please check your syntax. ^ -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**fuzz_crash_003.md:1:1:1:6:** -```roc -= "te -``` -^^^^^ - - # TOKENS ~~~zig OpAssign,StringStart,StringPart,StringEnd, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_004.md b/test/snapshots/fuzz_crash/fuzz_crash_004.md index abd75da4a8..1f64de1992 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_004.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_004.md @@ -9,7 +9,6 @@ F ~~~ # EXPECTED PARSE ERROR - fuzz_crash_004.md:2:1:2:1 -MISSING MAIN! FUNCTION - fuzz_crash_004.md:1:1:1:2 # PROBLEMS **PARSE ERROR** Type applications require parentheses around their type arguments. @@ -34,20 +33,6 @@ Other valid examples: ^ -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**fuzz_crash_004.md:1:1:1:2:** -```roc -F -``` -^ - - # TOKENS ~~~zig UpperIdent, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_005.md b/test/snapshots/fuzz_crash/fuzz_crash_005.md index a28900f0ec..a886ce9f67 100644 --- a/test/snapshots/fuzz_crash/fuzz_crash_005.md +++ b/test/snapshots/fuzz_crash/fuzz_crash_005.md @@ -9,7 +9,6 @@ modu ~~~ # EXPECTED PARSE ERROR - fuzz_crash_005.md:1:1:1:5 -MISSING MAIN! FUNCTION - fuzz_crash_005.md:1:1:1:5 # PROBLEMS **PARSE ERROR** A parsing error occurred: `statement_unexpected_token` @@ -22,20 +21,6 @@ modu ^^^^ -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**fuzz_crash_005.md:1:1:1:5:** -```roc -modu -``` -^^^^ - - # TOKENS ~~~zig LowerIdent, diff --git a/test/snapshots/fuzz_crash/fuzz_crash_006.md b/test/snapshots/fuzz_crash/fuzz_crash_006.md index c6fcb9d67fa9fb4a27f7ec3830a980b73d5057e0..1be6f8731786f44281ee4295c72822a4b37b0bc6 100644 GIT binary patch delta 17 ZcmbQs-^;r}f^oAq<7wv2pIKKi0suC71~UKv delta 260 zcmeC>oy)&Lf>F=cGdS4O&t1XS(bG>+!7bF!ImFZ7PeE59t+c8tKDj8dI3wP`z)UYU z#mdmiXtOZm1?GA!E$q6qw76VS(-KQ_N)!?c3KVklQ%ZAEixqN9i%S$T63bE*5)~41 z6EpJ^6M&}YC6{F8=jm~A`Q>AXDwHP{E2QO@=A{7T9aB<(8o~M?+AM+k6ml}NQ?0ll p#wpk;)Fc+A*CE# -**COMPTIME EVAL ERROR** -This definition could not be evaluated at compile time: -**if_then_else_simple_file.md:1:7:5:6:** -```roc -foo = if 1 A - - else { - "hello" - } -``` - -The evaluation failed with error: - **TypeMismatch** - # TOKENS ~~~zig LowerIdent,OpAssign,KwIf,Int,UpperIdent, diff --git a/test/snapshots/import_exposing_basic.md b/test/snapshots/import_exposing_basic.md index fbf58fa936..34797102d4 100644 --- a/test/snapshots/import_exposing_basic.md +++ b/test/snapshots/import_exposing_basic.md @@ -52,21 +52,6 @@ Is there an `import` or `exposing` missing up-top? ^^^^^^ -**COMPTIME EVAL ERROR** -This definition could not be evaluated at compile time: -**import_exposing_basic.md:3:8:8:2:** -```roc -main = { - data = { name: "Alice", age: 30 } - encoded = encode(data) - decoded = decode(encoded) - decoded -} -``` - -The evaluation failed with error: - **TypeMismatch** - # TOKENS ~~~zig KwImport,LowerIdent,NoSpaceDotUpperIdent,KwExposing,OpenSquare,LowerIdent,Comma,LowerIdent,CloseSquare, diff --git a/test/snapshots/lambda_multi_arg_mismatch.md b/test/snapshots/lambda_multi_arg_mismatch.md index 8b298d8d05..1886d9dd25 100644 --- a/test/snapshots/lambda_multi_arg_mismatch.md +++ b/test/snapshots/lambda_multi_arg_mismatch.md @@ -84,25 +84,6 @@ But the third argument has the type: `multi_arg_fn` needs these arguments to have compatible types. -**COMPTIME EVAL ERROR** -This definition could not be evaluated at compile time: -**lambda_multi_arg_mismatch.md:8:10:17:2:** -```roc -result = multi_arg_fn( - 42, # x1: U64 (type 'a') - "hello", # x2: Str (type 'b') - correct - "world", # x3: Str (should be 'a' = U64) - MISMATCH - 1.5, # x4: F64 (type 'c') - correct - 3.14, # x5: F64 (should be 'a' = U64) - MISMATCH - [1, 2], # x6: List I64 (type 'd') - correct - True, # x7: Bool (should be 'a' = U64) - MISMATCH - "done", # x8: Str (type 'e') - correct -) -``` - -The evaluation failed with error: - **NotImplemented** - # TOKENS ~~~zig LowerIdent,OpColon,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,OpArrow,OpenRound,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,CloseRound, diff --git a/test/snapshots/nominal/nominal_associated_lookup_in_containers.md b/test/snapshots/nominal/nominal_associated_lookup_in_containers.md index 0e44caa4b4..3be419b287 100644 --- a/test/snapshots/nominal/nominal_associated_lookup_in_containers.md +++ b/test/snapshots/nominal/nominal_associated_lookup_in_containers.md @@ -171,7 +171,7 @@ nested = { bar: A, count: 1 } (inferred-types (defs (patt (type "List(Foo.Bar)")) - (patt (type "Try(Foo.Bar, Foo.Error)")) + (patt (type "Error")) (patt (type "{ bar: Foo.Bar, count: Num(Int(Unsigned64)) }"))) (type_decls (nominal (type "Foo") @@ -182,6 +182,6 @@ nested = { bar: A, count: 1 } (ty-header (name "Foo.Error")))) (expressions (expr (type "List(Foo.Bar)")) - (expr (type "Try(Foo.Bar, Foo.Error)")) + (expr (type "Error")) (expr (type "{ bar: Foo.Bar, count: Num(Int(Unsigned64)) }")))) ~~~ diff --git a/test/snapshots/nominal/nominal_associated_vs_module.md b/test/snapshots/nominal/nominal_associated_vs_module.md index 86b223880c..aac13e4c21 100644 --- a/test/snapshots/nominal/nominal_associated_vs_module.md +++ b/test/snapshots/nominal/nominal_associated_vs_module.md @@ -14,29 +14,9 @@ useBar : Foo.Bar useBar = Something ~~~ # EXPECTED -TYPE MODULE MISSING MATCHING TYPE - nominal_associated_vs_module.md:1:1:7:19 +NIL # PROBLEMS -**TYPE MODULE MISSING MATCHING TYPE** -Type modules must have a type declaration matching the module name. - -This file is named `nominal_associated_vs_module`.roc, but no top-level type declaration named `nominal_associated_vs_module` was found. - -Add either: -`nominal_associated_vs_module := ...` (nominal type) -or: -`nominal_associated_vs_module : ...` (type alias) -**nominal_associated_vs_module.md:1:1:7:19:** -```roc -Foo := [Whatever].{ - Bar := [Something] -} - -# This should resolve to the local Foo.Bar, not try to import from a Foo module -useBar : Foo.Bar -useBar = Something -``` - - +NIL # TOKENS ~~~zig UpperIdent,OpColonEqual,OpenSquare,UpperIdent,CloseSquare,Dot,OpenCurly, diff --git a/test/snapshots/plume_package/Color.md b/test/snapshots/plume_package/Color.md index 58554dda70..fd4ace4b83 100644 --- a/test/snapshots/plume_package/Color.md +++ b/test/snapshots/plume_package/Color.md @@ -96,7 +96,6 @@ TYPE DOES NOT HAVE METHODS - Color.md:37:21:37:45 TYPE DOES NOT HAVE METHODS - Color.md:38:21:38:45 TYPE DOES NOT HAVE METHODS - Color.md:39:21:39:45 TYPE DOES NOT HAVE METHODS - Color.md:40:21:40:45 -TYPE MISMATCH - Color.md:32:5:45:6 TYPE DOES NOT HAVE METHODS - Color.md:62:8:62:28 # PROBLEMS **MODULE HEADER DEPRECATED** @@ -314,32 +313,6 @@ This type doesn't support methods: -**TYPE MISMATCH** -This expression is used in an unexpected way: -**Color.md:32:5:45:6:** -```roc - match bytes { - ['#', a, b, c, d, e, f] => { - is_valid = - a.is_char_in_hex_range() - and b.is_char_in_hex_range() - and c.is_char_in_hex_range() - and d.is_char_in_hex_range() - and e.is_char_in_hex_range() - and f.is_char_in_hex_range() - - if is_valid Ok(Color.Hex(str)) else Err(InvalidHex("Expected Hex to be in the range 0-9, a-f, A-F, got ${str}")) - } - _ => Err(InvalidHex("Expected Hex must start with # and be 7 characters long, got ${str}")) - } -``` - -It has the type: - _[InvalidHex(Str), Err([InvalidHex(Str)]_others)][Ok(Color)]_others2_ - -But the type annotation says it should have the type: - _Try(Color, [InvalidHex(Str)])_ - **TYPE DOES NOT HAVE METHODS** You're calling the method `is_named_color` on a type that doesn't support methods: **Color.md:62:8:62:28:** @@ -1305,7 +1278,7 @@ is_named_color = |str| { (patt (type "Num(Int(Unsigned8)), Num(Int(Unsigned8)), Num(Int(Unsigned8)), Num(Int(Unsigned8)) -> Color")) (patt (type "Str -> Error")) (patt (type "Color -> Error")) - (patt (type "Str -> Try(Color, [UnknownColor(Str)])")) + (patt (type "Str -> Error")) (patt (type "_arg -> Error"))) (type_decls (nominal (type "Color") @@ -1315,6 +1288,6 @@ is_named_color = |str| { (expr (type "Num(Int(Unsigned8)), Num(Int(Unsigned8)), Num(Int(Unsigned8)), Num(Int(Unsigned8)) -> Color")) (expr (type "Str -> Error")) (expr (type "Color -> Error")) - (expr (type "Str -> Try(Color, [UnknownColor(Str)])")) + (expr (type "Str -> Error")) (expr (type "_arg -> Error")))) ~~~ diff --git a/test/snapshots/records/statement_record_destructure.md b/test/snapshots/records/statement_record_destructure.md index fb24994f2c..3a0be32dd3 100644 --- a/test/snapshots/records/statement_record_destructure.md +++ b/test/snapshots/records/statement_record_destructure.md @@ -21,17 +21,6 @@ Is there an `import` or `exposing` missing up-top? ^^^^^^ -**COMPTIME CRASH** -This definition crashed during compile-time evaluation: -**statement_record_destructure.md:1:24:1:30:** -```roc -{ name, age, email } = person -``` - ^^^^^^ - -The `crash` happened with this message: - **Runtime error in expression** - # TOKENS ~~~zig OpenCurly,LowerIdent,Comma,LowerIdent,Comma,LowerIdent,CloseCurly,OpAssign,LowerIdent, diff --git a/test/snapshots/some_folder/002.md b/test/snapshots/some_folder/002.md index 80cf7b225a..87e220f250 100644 --- a/test/snapshots/some_folder/002.md +++ b/test/snapshots/some_folder/002.md @@ -16,7 +16,6 @@ PARSE ERROR - 002.md:1:1:1:3 PARSE ERROR - 002.md:1:4:1:6 PARSE ERROR - 002.md:1:7:1:8 PARSE ERROR - 002.md:1:8:1:9 -MISSING MAIN! FUNCTION - 002.md:1:1:5:12 # PROBLEMS **PARSE ERROR** A parsing error occurred: `statement_unexpected_token` @@ -62,23 +61,6 @@ This is an unexpected parsing error. Please check your syntax. ^ -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**002.md:1:1:5:12:** -```roc -@2 := {} - -foo = "one" - -bar = "two" -``` - - # TOKENS ~~~zig OpaqueName,OpColonEqual,OpenCurly,CloseCurly, diff --git a/test/snapshots/type_app_complex_nested.md b/test/snapshots/type_app_complex_nested.md index fb5be29fd5..d61494df91 100644 --- a/test/snapshots/type_app_complex_nested.md +++ b/test/snapshots/type_app_complex_nested.md @@ -33,8 +33,6 @@ UNDECLARED TYPE - type_app_complex_nested.md:4:27:4:32 UNDECLARED TYPE - type_app_complex_nested.md:4:48:4:53 UNUSED VARIABLE - type_app_complex_nested.md:7:12:7:21 UNDECLARED TYPE - type_app_complex_nested.md:12:14:12:19 -TOO MANY ARGS - type_app_complex_nested.md:18:41:18:60 -TOO MANY ARGS - type_app_complex_nested.md:4:38:4:58 # PROBLEMS **UNDECLARED TYPE** The type _Maybe_ is not declared in this scope. @@ -103,26 +101,6 @@ deepNested : Maybe(Try(List(Dict(Str, a)), _b)) -> a ^^^^^ -**TOO MANY ARGS** -The type _Dict_ expects argument, but got instead. -**type_app_complex_nested.md:18:41:18:60:** -```roc -ComplexType(a, b) : Try(List(Maybe(a)), Dict(Str, Error(b))) -``` - ^^^^^^^^^^^^^^^^^^^ - - - -**TOO MANY ARGS** -The type _Dict_ expects argument, but got instead. -**type_app_complex_nested.md:4:38:4:58:** -```roc -processComplex : Try(List(Maybe(a)), Dict(Str, Error(_b))) -> List(a) -``` - ^^^^^^^^^^^^^^^^^^^^ - - - # TOKENS ~~~zig KwApp,OpenSquare,LowerIdent,CloseSquare,OpenCurly,LowerIdent,OpColon,KwPlatform,StringStart,StringPart,StringEnd,CloseCurly, @@ -351,7 +329,7 @@ main! = |_| processComplex(Ok([Some(42), None])) ~~~clojure (inferred-types (defs - (patt (type "Try(List(Error), Error) -> List(_c)")) + (patt (type "Error -> List(_c)")) (patt (type "Error -> _ret")) (patt (type "_arg -> List(_c)"))) (type_decls @@ -361,7 +339,7 @@ main! = |_| processComplex(Ok([Some(42), None])) (ty-rigid-var (name "a")) (ty-rigid-var (name "b")))))) (expressions - (expr (type "Try(List(Error), Error) -> List(_c)")) + (expr (type "Error -> List(_c)")) (expr (type "Error -> _ret")) (expr (type "_arg -> List(_c)")))) ~~~ diff --git a/test/snapshots/type_app_multiple_args.md b/test/snapshots/type_app_multiple_args.md index 276befa98d..74c04d6d55 100644 --- a/test/snapshots/type_app_multiple_args.md +++ b/test/snapshots/type_app_multiple_args.md @@ -14,7 +14,6 @@ main! = |_| processDict(Dict.empty().insert("one", 1)) ~~~ # EXPECTED DOES NOT EXIST - type_app_multiple_args.md:6:25:6:35 -TOO MANY ARGS - type_app_multiple_args.md:3:15:3:29 # PROBLEMS **DOES NOT EXIST** `Dict.empty` does not exist. @@ -26,16 +25,6 @@ main! = |_| processDict(Dict.empty().insert("one", 1)) ^^^^^^^^^^ -**TOO MANY ARGS** -The type _Dict_ expects argument, but got instead. -**type_app_multiple_args.md:3:15:3:29:** -```roc -processDict : Dict(Str, U64) -> List(Str) -``` - ^^^^^^^^^^^^^^ - - - # TOKENS ~~~zig KwApp,OpenSquare,LowerIdent,CloseSquare,OpenCurly,LowerIdent,OpColon,KwPlatform,StringStart,StringPart,StringEnd,CloseCurly, diff --git a/test/snapshots/type_app_nested.md b/test/snapshots/type_app_nested.md index 23444c899d..807688f56a 100644 --- a/test/snapshots/type_app_nested.md +++ b/test/snapshots/type_app_nested.md @@ -127,9 +127,9 @@ main! = |_| processNested([]) ~~~clojure (inferred-types (defs - (patt (type "List(Try(Str, Error)) -> List(Str)")) + (patt (type "List(Error) -> List(Str)")) (patt (type "_arg -> List(Str)"))) (expressions - (expr (type "List(Try(Str, Error)) -> List(Str)")) + (expr (type "List(Error) -> List(Str)")) (expr (type "_arg -> List(Str)")))) ~~~ diff --git a/test/snapshots/type_comprehensive_scope.md b/test/snapshots/type_comprehensive_scope.md index 0b0c20cea8..2eaa3b6b80 100644 --- a/test/snapshots/type_comprehensive_scope.md +++ b/test/snapshots/type_comprehensive_scope.md @@ -107,6 +107,16 @@ BadType : SomeUndeclaredType ^^^^^^^^^^^^^^^^^^ +**TOO MANY ARGS** +The type _Dict_ expects argument, but got instead. +**type_comprehensive_scope.md:29:10:29:24:** +```roc +MyDict : Dict(Str, U64) +``` + ^^^^^^^^^^^^^^ + + + # TOKENS ~~~zig UpperIdent,OpColon,UpperIdent, diff --git a/test/snapshots/type_module/WrongName.md b/test/snapshots/type_module/WrongName.md index 72556fae70..0925408dcf 100644 --- a/test/snapshots/type_module/WrongName.md +++ b/test/snapshots/type_module/WrongName.md @@ -8,24 +8,9 @@ type=file SomeOtherName := [A, B] ~~~ # EXPECTED -TYPE MODULE MISSING MATCHING TYPE - WrongName.md:1:1:1:24 +NIL # PROBLEMS -**TYPE MODULE MISSING MATCHING TYPE** -Type modules must have a type declaration matching the module name. - -This file is named `WrongName`.roc, but no top-level type declaration named `WrongName` was found. - -Add either: -`WrongName := ...` (nominal type) -or: -`WrongName : ...` (type alias) -**WrongName.md:1:1:1:24:** -```roc -SomeOtherName := [A, B] -``` -^^^^^^^^^^^^^^^^^^^^^^^ - - +NIL # TOKENS ~~~zig UpperIdent,OpColonEqual,OpenSquare,UpperIdent,Comma,UpperIdent,CloseSquare, diff --git a/test/snapshots/type_module/no_type_no_main.md b/test/snapshots/type_module/no_type_no_main.md index 909880c5d5..0dc41cdb97 100644 --- a/test/snapshots/type_module/no_type_no_main.md +++ b/test/snapshots/type_module/no_type_no_main.md @@ -8,22 +8,9 @@ type=file x = 5 ~~~ # EXPECTED -MISSING MAIN! FUNCTION - no_type_no_main.md:1:1:1:6 +NIL # PROBLEMS -**MISSING MAIN! FUNCTION** -Default app modules must have a `main!` function. - -No `main!` function was found. - -Add a main! function like: -`main! = |arg| { ... }` -**no_type_no_main.md:1:1:1:6:** -```roc -x = 5 -``` -^^^^^ - - +NIL # TOKENS ~~~zig LowerIdent,OpAssign,Int, diff --git a/test/snapshots/type_tag_union_basic.md b/test/snapshots/type_tag_union_basic.md index 186bfb7e88..1f06babf91 100644 --- a/test/snapshots/type_tag_union_basic.md +++ b/test/snapshots/type_tag_union_basic.md @@ -254,12 +254,12 @@ main! = |_| {} (inferred-types (defs (patt (type "[None, Some(Str)] -> Str")) - (patt (type "[Err2(_err)][Ok2(_ok)] -> Bool")) - (patt (type "[Err2(_err2)][Ok2(_ok2)] -> Bool")) + (patt (type "[Err2(_err)][Ok2(_ok)] -> Error")) + (patt (type "[Err2(_err2)][Ok2(_ok2)] -> Error")) (patt (type "_arg -> {}"))) (expressions (expr (type "[None, Some(Str)] -> Str")) - (expr (type "[Err2(_err)][Ok2(_ok)] -> Bool")) - (expr (type "[Err2(_err2)][Ok2(_ok2)] -> Bool")) + (expr (type "[Err2(_err)][Ok2(_ok)] -> Error")) + (expr (type "[Err2(_err2)][Ok2(_ok2)] -> Error")) (expr (type "_arg -> {}")))) ~~~ diff --git a/test/snapshots/type_tag_union_complex.md b/test/snapshots/type_tag_union_complex.md index 8a286858d0..367a447de8 100644 --- a/test/snapshots/type_tag_union_complex.md +++ b/test/snapshots/type_tag_union_complex.md @@ -243,7 +243,7 @@ NO CHANGE ~~~clojure (inferred-types (defs - (patt (type "Try(ok, err) -> Str")) + (patt (type "Error -> Str")) (patt (type "Response -> Str")) (patt (type "_arg -> {}"))) (type_decls @@ -258,7 +258,7 @@ NO CHANGE (alias (type "ConnectionState") (ty-header (name "ConnectionState")))) (expressions - (expr (type "Try(ok, err) -> Str")) + (expr (type "Error -> Str")) (expr (type "Response -> Str")) (expr (type "_arg -> {}")))) ~~~ diff --git a/test/snapshots/type_var_nested.md b/test/snapshots/type_var_nested.md index 6a4496fb6b..c7f4c4c075 100644 --- a/test/snapshots/type_var_nested.md +++ b/test/snapshots/type_var_nested.md @@ -342,17 +342,17 @@ main = |_| "done" ~~~clojure (inferred-types (defs - (patt (type "Try(a, e), (a -> b) -> Try(b, e)")) + (patt (type "Error, (a -> b) -> Error")) (patt (type "a -> a")) (patt (type "a, b -> { first: a, second: b }")) (patt (type "List(_a) -> Num(Int(Unsigned64))")) - (patt (type "a -> Try(Try(a, Str), Str)")) + (patt (type "a -> Error")) (patt (type "_arg -> Str"))) (expressions - (expr (type "Try(a, e), (a -> b) -> Try(b, e)")) + (expr (type "Error, (a -> b) -> Error")) (expr (type "a -> a")) (expr (type "a, b -> { first: a, second: b }")) (expr (type "List(_a) -> Num(Int(Unsigned64))")) - (expr (type "a -> Try(Try(a, Str), Str)")) + (expr (type "a -> Error")) (expr (type "_arg -> Str")))) ~~~