Skip to content

Panic: builtin Str interpolation constraint had no metadata #10204

Description

@niclas-ahden
# Foo.roc
Foo := [].{
    parse = |text| "bad ${text}"
}
# main.roc 
app [main!] { pf: platform "../platform/main.roc" }

import pf.Stdout
import Foo

main! = || {
    Stdout.line!(Foo.parse("hello world"))
}

roc check main.roc panics:

    ./zig-out/bin/roc check main.roc
thread 1262393 panic: type checker invariant violated: builtin Str interpolation constraint had no metadata
/home/niclas/dev/roc/src/check/Check.zig:19749:28: 0x71e14c8 in satisfyBuiltinStrInterpolation (mod.zig)
            std.debug.panic("type checker invariant violated: builtin Str interpolation constraint had no metadata", .{});
                           ^
/home/niclas/dev/roc/src/check/Check.zig:18885:72: 0x70b9ac5 in checkStaticDispatchConstraints (mod.zig)
                            if (try self.satisfyBuiltinStrInterpolation(deferred_constraint.var_, constraint, env)) {
                                                                       ^
/home/niclas/dev/roc/src/check/Check.zig:13600:44: 0x7222664 in checkExpr (mod.zig)
    try self.checkStaticDispatchConstraints(env, false);
                                           ^
/home/niclas/dev/roc/src/check/Check.zig:12662:35: 0x720fe26 in checkExpr (mod.zig)
                try self.checkExpr(block.final_expr, env, expected);
                                  ^
/home/niclas/dev/roc/src/check/Check.zig:12816:63: 0x7212217 in checkExpr (mod.zig)
                const lambda_body_does_fx = try self.checkExpr(lambda.body, env, lambda_body_expected.withBranchResult(expected_func.ret));
                                                              ^
/home/niclas/dev/roc/src/check/Check.zig:9059:43: 0x732bd5b in checkDef (mod.zig)
    const def_does_fx = try self.checkExpr(def.expr, env, def_expectation);
                                          ^
/home/niclas/dev/roc/src/check/Check.zig:9388:26: 0x7329515 in checkGroup (mod.zig)
        try self.checkDef(scc.defs[0], env);
                         ^
/home/niclas/dev/roc/src/check/Check.zig:9352:40: 0x7328ac5 in ensureGroupChecked (mod.zig)
        .pending => try self.checkGroup(group_index, env),
                                       ^
/home/niclas/dev/roc/src/check/Check.zig:5434:36: 0x6f6af42 in checkFileInternal (mod.zig)
        try self.ensureGroupChecked(group_index, &env);
                                   ^
/home/niclas/dev/roc/src/check/Check.zig:5321:34: 0x6f68c26 in checkFile (mod.zig)
    return self.checkFileInternal(false);
                                 ^
/home/niclas/dev/roc/src/compile/compile_package.zig:1938:30: 0x6f65594 in typeCheckModule (mod.zig)
        try checker.checkFile();
                             ^
/home/niclas/dev/roc/src/compile/coordinator.zig:4467:78: 0x6f5fbfc in executeTypeCheckFallible (mod.zig)
        var typecheck_output = try compile_package.PackageEnv.typeCheckModule(
                                                                             ^
/home/niclas/dev/roc/src/compile/coordinator.zig:4435:45: 0x6b3fa29 in executeTypeCheck (mod.zig)
        return self.executeTypeCheckFallible(task, allocators) catch |err| switch (err) {
                                            ^
/home/niclas/dev/roc/src/compile/coordinator.zig:2667:53: 0x6b3f2e0 in executeTaskInline (mod.zig)
            .type_check => |t| self.executeTypeCheck(t, allocators),
                                                    ^
/home/niclas/dev/roc/src/compile/coordinator.zig:4622:50: 0x7601950 in workerThread (mod.zig)
            const result = self.executeTaskInline(t, worker_allocs.taskAllocators()) catch |err| switch (err) {
                                                 ^
roc check
/nix/store/n1hqsn4a4yfmipzyk2byavvx4ccx6ccr-zig-0.16.0/lib/zig/std/Thread.zig:422:13: 0x7601435 in callFn__anon_432516 (std.zig)
            @call(.auto, f, args);
            ^
/nix/store/n1hqsn4a4yfmipzyk2byavvx4ccx6ccr-zig-0.16.0/lib/zig/std/Thread.zig:752:30: 0x7601279 in entryFn (std.zig)
                return callFn(f, args_ptr.*);
                             ^
/nix/store/n1hqsn4a4yfmipzyk2byavvx4ccx6ccr-zig-0.16.0/lib/zig/libc/musl/src/thread/pthread_create.c:207:17: 0xe8c8f1f in start (/nix/store/n1hqsn4a4yfmipzyk2byavvx4ccx6ccr-zig-0.16.0/lib/zig/libc/musl/src/thread/pthread_create.c)
	__pthread_exit(args->start_func(args->start_arg));
                ^
Unwind error at address `/proc/self/exe:0xe8c8f1f` (unwind info unavailable), remaining frames may be incorrect
[1]    1262365 abort (core dumped)  ./zig-out/bin/roc check main.roc

@rtfeldman Could this be a regression from #10160?

Tested on NixOS, x86, Roc f9035817efc4d5af63beba8a813c796fa4a9d17c.

Metadata

Metadata

Assignees

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