JSMonk / hegel

An advanced static type checker
https://hegel.js.org
MIT License
2.09k stars 59 forks source link

Incorrect Return Type #204

Closed leushkin closed 4 years ago

leushkin commented 4 years ago

https://hegel.js.org/try#C4TwDgpgBAcghsKBeKBGKAfKAmAULgMwFcA7AY2AEsB7EqYCAZ2AAoA3OAGwC5YEBKKAG8oAelFQA7gCdaAc3rgIuKKqiNJlYGQAW7LoKEq1JsnEbRUvaRGBFpdAOSpHxk6rMWc12-afZXdzUAEwgCOCJOYB87ByhHQLUAX1wkoA

I think I understand why is this bug happen. At call.js file, isFinal variable checks whether creator block or not, it works fine for if statement, but not for switch, because its creator is undefined for some reason. I tried to change .every(parent => parent.creator === "block"); with .every(parent => parent.type === "block"); , and everything was working as expected, but I broke some tests =(

I can take a look why does creator variable is undefined for switch statement

JSMonk commented 4 years ago

Fixed in 0.0.43 release. Thank you for the contribution ^_^.