escalier-lang / escalier-next

Improved type safety with tight TypeScript interop
https://escalier-lang.github.io/escalier-next/
MIT License
14 stars 0 forks source link

Only require invariance on type params that are unions, not on all unions #360

Open kevinbarabash opened 2 months ago

kevinbarabash commented 2 months ago

e.g.

let foo = fn(mut arg: A | B) { ... };
let mut a: A = ...
foo(a); // this should be allowed

let bar = fn(mut arg: (A | B)[]) { ... };
let mut array: A[];
bar(array); // this should still be prohibited