Skip to content

Crash due to bad type inference #2891

@mzagozen

Description

@mzagozen

Acton Version

0.27.0.20260605.14.4.33

Steps to Reproduce and Observed Behavior

actor Box():
    var connected = 0 # <— without an explicit int annotation, this is typed as value
    def set_connected(c: int):
        connected = c
    def report():
        print(str(connected))

actor main(env):
    b = Box()
    b.set_connected(1)
    b.report()
    env.exit(0) 

Running acton --types with the latest version:

mzagozen@mekic actonrepro % acton --types repro_min.act
Building file repro_min.act using temporary scratch directory
 ⠋ repro_min  Type checking 2/2                0.004 s


== types: repro_min ================================
W_Box_111: __builtin__.Number[__builtin__.int] = __builtin__.IntegralD_int()

# recursive group:
actor Box ():
    var connected: ?__builtin__.value = W_Box_111.__fromatom__(0)
    proc def set_connected (c : __builtin__.int) -> None:
        connected = c
    proc def report () -> None:
        print@[(__builtin__.str,)](*(str(val = connected),), sep = None, end = None, err = None, flush = None)
actor main (env : __builtin__.Env):
    b: Box = Box()
    b.set_connected(c = W_Box_111.__fromatom__(1))
    b.report()
    env.exit(n = W_Box_111.__fromatom__(0))
# (recursive group)
====================================================

Running acton --types with 0.27.0.20260604.10.23 (just before new-unbox)

mzagozen@refosko:/tmp/ac$ acton --types repro.act
Building file repro.act using temporary scratch directory
 ⠋ repro  Type checking 2/2                                                      0.007 s


== types: repro ================================
W_Box_110: __builtin__.Number[__builtin__.int] = __builtin__.IntegralD_int()

# recursive group:
actor Box ():
    var connected: __builtin__.int = W_Box_110.__fromatom__(0)
    proc def set_connected (c : __builtin__.int) -> None:
        connected = c
    proc def report () -> None:
        print@[(__builtin__.str,)](*(str(val = connected),), sep = None, end = None, err = None, flush =
 None)
actor main (env : __builtin__.Env):
    b: Box = Box()
    b.set_connected(c = W_Box_110.__fromatom__(1))
    b.report()
    env.exit(n = W_Box_110.__fromatom__(0))
# (recursive group)

Expected Behavior

Not crash, infer connected as int?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions