microsoft/BosqueLanguage

Switch on type example from language doc doesn't compile.

Ivo-Balbaert opened this issue · 0 comments

Describe the bug
The switch on type code snippet described in the Language Docs § 6.8 does not compile.

To Reproduce

namespace NSMain;

entrypoint function main(): Any {
let x = false;
switch(x) {
type Bool => { return false; }
type Int => { return 0; }
type String => {return ""; }
type {f: Int, g?: Bool} => { return x.f; }
case _ => { return none; }
}
}

This does not compile and gives the error:
Parse error -- ["switch_types.bsq",5,"Value is always of type"]
on the line: switch(x) {

Expected behavior
false should be shown as return value

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10 64 bit
  • Bosque Version: installed from master Jul 27