DenialAdams / roland

Roland programming language
https://www.brick.codes/roland
Apache License 2.0
48 stars 0 forks source link

Unions containg never can now be constructed via DAA, which violates assumption that never expressions are unreachable #123

Closed DenialAdams closed 11 months ago

DenialAdams commented 11 months ago
union U {
   a: bool,
   b: !,
}
proc main() {
   let x: Union;
   x.a = 10;
   x.b;
   // Roland assumes anything hereafter is unreachable, but it will be reached
}
DenialAdams commented 11 months ago

We have this same problem with:

proc main() {
   let a = 10;
   let x = gen$<!>(&a);
}

proc gen<T>(x: &u8) -> &T {
   return x transmute &T;
}

I think we need to simply legislate this: an expression producing a type of never will trap

DenialAdams commented 11 months ago

Closed in 8bb875a817abe4817ab5837b74df53171a18c390