tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
267 stars 53 forks source link

Ternary optional type error #392

Closed 0kenx closed 1 week ago

0kenx commented 1 week ago
struct Bar {
    a: Cell?;
}

struct Baz {}

fun foo(x: Cell?): Bar {
    let cond: Bool = true;
    return Bar {
        a: cond ? Baz {}.toCell() : x;
    }
}

Produced error: Non-matching types "Cell" and "Cell?" for ternary branches Expected behavior: should be allowed because Cell value can be assigned to Cell?. Baz {}.toCell() should be deduced to be the non-null value of type Cell?.