Skip to content

TVar error shows up in release mode but not development mode #1730

@stylewarning

Description

@stylewarning

(Reported by @Jason94.)

I'm getting a strange error when I try to compile a file in release mode. In dev mode, it compiles and runs fine. Here is the error:

; compiling file "/home/jason/programming/workspace/coalton-simple-io/examples/channels-threading.lisp" (written 19 DEC 2025 11:45:43 AM):
; 
; caught COMMON-LISP:ERROR:
;   COMMON-LISP:READ error during COMMON-LISP:COMPILE-FILE:
;   
;     The value
;       #T71411
;     is not of type
;       COALTON-IMPL/TYPECHECKER/TYPES:TYCON
;   
;     (in form starting at line: 34, column: 0, position: 1005)
; 
; compilation unit aborted
;   caught 1 fatal ERROR condition
;   caught 1 ERROR condition

This is the file in question. L102 seems to be the offending line. This compiles:

  (declare sum-file (IO Integer))
  (define sum-file
    (do
     write-data-file
     (_input-chan <- mv:new-empty-chan)
     (_ints-chan <- mv:new-empty-chan)
     (write-line "Forking threads...")
     ;; (fork-thread (reader-thread input-chan))
     ;; ...
     (pure 0)))

But with 102 uncommented, it fails:

  (declare sum-file (IO Integer))
  (define sum-file
    (do
     write-data-file
     (_input-chan <- mv:new-empty-chan)
     (_ints-chan <- mv:new-empty-chan)
     (write-line "Forking threads...")
     (fork-thread (reader-thread _input-chan))
     ;; ...
     (pure 0)))

(And again, that compiles just fine in development mode. The whole thing does.

I'm pretty sure this is a bug, because if it compiles in dev mode it should be compiling in release mode. Plus it shouldn't leak TVars.

The steps I took switching between modes:

  1. Switch mode in my init
  2. Run rm **/*.fasl in my repo root
  3. Delete ~/.cache/common_lisp to force
  4. Restart my REPL

Metadata

Metadata

Assignees

No one assigned

    Labels

    codegenCode generation matters (Coalton -> Lisp)type systemThe Coalton type system

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions