You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem persists into 3.6.2. The issue appears to specifically affect unions of singleton types from literals + occuring inside a pair type. Other union types will be inferred correctly:
traitCell[+T]:defforeach[U](f: T=>U):UtraitAtraitBextendsAtraitCextendsAtraitDextendsAtypeUnion1=B|C|DobjectXobjectYobjectZtypeUnion2=X.type|Y.type|Z.typetypeUnion3="1"|"2"|"3"traitTest:valcell1:Cell[(String,Union1)]
valcell2:Cell[(String,Union2)]
valcell3:Cell[(String,Union3)]
valcell4:Cell[Union3]
deftest=
cell1.foreach { (s,u) => summon[u.type<:<Union1] } // ok
cell2.foreach { (s,u) => summon[u.type<:<Union2] } // ok
cell2.foreach { p =>valu= p._2; summon[u.type<:<Union2] } // ok
cell3.foreach { (s,u) => summon[u.type<:<Union3] } // error
cell3.foreach { p =>valu= p._2; summon[u.type<:<Union3] } // error
cell4.foreach { u => summon[u.type<:<Union3] } // ok (!)
goshacodes
changed the title
OR type is not inferred correctly
Union of literal types is not inferred correctly
Dec 16, 2024
Compiler version
3.3.4
Minimized code
Output
Expectation
Compiles
The text was updated successfully, but these errors were encountered: