Skip to content

Regression on assigning 0 to struct field with types whose static constructor is non-nullable #165

Description

@armoha

Regression due to armoha/eudplib@6d1aaa7

object Foo {
    var cunit: CUnit;
    function constructor() {
        this.cunit = 0;
    }
}
/*
it compiles to `this.cunit = CUnit.cast(0);` and raises compile error
because `CUnit.__init__(int | EUDVariable)` only accepts valid non-null value
(EPD(0x59CCA8) + 84 × 0~1699) and disallow 0.
*/

https://github.com/armoha/eudplib/blob/f10e069e0008afa3d473b673c4078b6d8765d105/src/eudplib/core/eudstruct/eudstruct.py#L131-L135
Either EUDStruct.setfield or CUnit.__init__ should be fixed to always allow every int for field assignments or be consistent to allow 0 for constructing CUnit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions