Skip to content

Panic: tag count failed Lambda Solved unification #10208

Description

@JRI98
main! : List(Str) => Try({}, [Exit(I8), ..])
main! = |_| {
	match read_and_handle_message({}) {
		Ok({}) => Ok({}),
		Err(_) => Err(Exit(1))
	}
}

Message : [
	INFO({ version: Str }),
	PING,
]

decode_message : {} -> Try(Message, Encoding.Json.ParseErr)
decode_message = |_| {
	s = Json.parse("")?
	Ok(INFO(s))
}

read_and_handle_message : {} -> Try({}, [StdoutErr(Str), InvalidJson(Str), MissingRequiredField(Str), ..])
read_and_handle_message = |_| {
	message = decode_message({})?
	match message {
		PING => Ok({}),
		INFO(_) => Ok({}),
	}
}
➜  roc git:(main) ✗ roc main.roc

┌─────────────────────────┐
│ UNCONDITIONAL CONDITION ├─ This match value is known at compile time, so this match will always inspect the same value. ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
└┬────────────────────────┘                                                                                                                                                                                                                                                                                          │
 │                                                                                                                                                                                                                                                                                                                   │
 │  match read_and_handle_message({}) {                                                                                                                                                                                                                                                                              │
 │        ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾                                                                                                                                                                                                                                                                                │
 └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── main.roc:3:8 ┘



Found 0 error(s) and 1 warning(s) for main.roc.
thread 4857173 panic: postcheck invariant violated: tag count failed Lambda Solved unification
roc
  ✓ Resolving Dependencies  2ms
  ✓ Parsing                 0ms
  ✓ Name Resolution         0ms
  ✓ Type Inference          0ms
.../roc/src/postcheck/common.zig:112:24: 0x10a55c0b3 in invariant__anon_281774 (roc)
        std.debug.panic("postcheck invariant violated: {s}", .{message});
                       ^
.../roc/src/postcheck/lambda_solved/solve.zig:1712:57: 0x10a55b5ef in unifyTags (roc)
        if (lhs.count() != rhs.count()) Common.invariant("tag count failed Lambda Solved unification");
                                                        ^
.../roc/src/postcheck/lambda_solved/solve.zig:1501:39: 0x10a555a37 in unify (roc)
                    try self.unifyTags(left_tags, right_tags);
                                      ^
.../roc/src/postcheck/lambda_solved/solve.zig:991:23: 0x10a56ea2b in expectPat (roc)
        try self.unify(ty, expected);
                      ^
.../roc/src/postcheck/lambda_solved/solve.zig:721:42: 0x10a56d48b in bindPattern (roc)
        const pat_ty = try self.expectPat(pat_id, value_ty);
                                         ^
.../roc/src/postcheck/lambda_solved/solve.zig:775:41: 0x10a56e4cb in bindPatternAtType (roc)
                    try self.bindPattern(child, payload_ty);
                                        ^
.../roc/src/postcheck/lambda_solved/solve.zig:722:35: 0x10a56d603 in bindPattern (roc)
        try self.bindPatternAtType(pat_id, pat_ty);
                                  ^
.../roc/src/postcheck/lambda_solved/solve.zig:783:45: 0x10a56e6cb in bindPatternAtType (roc)
                        try self.bindPattern(backing, backing_ty);
                                            ^
.../roc/src/postcheck/lambda_solved/solve.zig:722:35: 0x10a56d603 in bindPattern (roc)
        try self.bindPatternAtType(pat_id, pat_ty);
                                  ^
.../roc/src/postcheck/lambda_solved/solve.zig:549:41: 0x10a574907 in inferExpr (roc)
                    try self.bindPattern(branch.pat, scrutinee_ty);
                                        ^
.../roc/src/postcheck/lambda_solved/solve.zig:654:52: 0x10a579063 in inferStmt (roc)
                const value_ty = try self.inferExpr(let_.value);
                                                   ^
.../roc/src/postcheck/lambda_solved/solve.zig:604:87: 0x10a5758e3 in inferExpr (roc)
                for (self.lifted.stmtSpan(block.statements)) |stmt| try self.inferStmt(stmt);
                                                                                      ^
.../roc/src/postcheck/lambda_solved/solve.zig:833:44: 0x10a56b4eb in expectExpr (roc)
        const inferred = try self.inferExpr(expr_id);
                                           ^
.../roc/src/postcheck/lambda_solved/solve.zig:457:40: 0x10a57328f in inferExpr (roc)
                _ = try self.expectExpr(let_.rest, expected);
                                       ^
.../roc/src/postcheck/lambda_solved/solve.zig:833:44: 0x10a56b4eb in expectExpr (roc)
        const inferred = try self.inferExpr(expr_id);
                                           ^
.../roc/src/postcheck/lambda_solved/solve.zig:274:40: 0x10a56b1b3 in solveFn (roc)
                _ = try self.expectExpr(body, func.ret);
                                       ^
.../roc/src/postcheck/lambda_solved/solve.zig:147:29: 0x10a54ef77 in solve (roc)
            try self.solveFn(fn_id, fn_);
                            ^
.../roc/src/postcheck/lambda_solved/solve.zig:43:21: 0x10a5488af in run (roc)
    try solver.solve();
                    ^
.../roc/src/lir/checked_pipeline.zig:247:54: 0x10a1e9e43 in lowerCheckedModulesToLir (roc)
    var solved = try postcheck.LambdaSolved.Solve.run(allocator, lifted);
                                                     ^
.../roc/src/cli/main.zig:9751:56: 0x10bdae157 in lowerCheckedSourceToLir (roc)
    return lir.CheckedPipeline.lowerCheckedModulesToLir(
                                                       ^
.../roc/src/cli/main.zig:5614:46: 0x10cd6cc73 in lowerLirWithBuildEnv (roc)
    var lowered = try lowerCheckedSourceToLir(
                                             ^
.../roc/src/cli/main.zig:5686:50: 0x10cd6aed7 in buildLirImageWithBuildEnv (roc)
    var lowered_result = try lowerLirWithBuildEnv(
                                                 ^
.../roc/src/cli/main.zig:3024:53: 0x10cd90157 in rocRunDefaultApp (roc)
    const shm_result = try buildLirImageWithBuildEnv(
                                                    ^
.../roc/src/cli/main.zig:2250:32: 0x10cd36f7b in rocRunSharedMemoryShim (roc)
        return rocRunDefaultApp(ctx, args, source);
                               ^
.../roc/src/cli/main.zig:2232:53: 0x10cd356df in rocRun (roc)
        .interpreter, .dev => rocRunSharedMemoryShim(ctx, args, arg0),
                                                    ^
.../roc/src/cli/main.zig:1187:19: 0x109ac0197 in mainArgs (roc)
            rocRun(&ctx, run_args, args[0]) catch |err| switch (err) {
                  ^
.../roc/src/cli/main.zig:1052:13: 0x109abe9e7 in main (roc)
    mainArgs(gpa, arena, args, init.io) catch |err| {
            ^
/opt/homebrew/Cellar/zig/0.16.0_1/lib/zig/std/start.zig:737:30: 0x109abb08b in callMain (roc)
    return wrapMain(root.main(.{
                             ^
???:?:?: 0x183903dff in start (/usr/lib/dyld)
[1]    2570 abort      roc main.roc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions