JSMonk / hegel

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

Incorrect type for always function #96

Closed leushkin closed 4 years ago

leushkin commented 4 years ago

Seems like weak polymorphism isn't working =( I tried to fix it by myself, but it was very hard, code base is complicated enough for me. I think that something wrong at generic-type.js in changeAll method. When hegel tries to change return type () => <_a> to () => 1 sourceTypes and targetTypes become empty arrays after sourceType.reduce and then this.subordinateType.changeAll don't change anything.

It would be great if you give me a hint to fix this, and I could take a look one more time, but more closely. But if it's hard to fix it would be better if you take this issue

https://jsmonk.github.io/hegel/try#GYVwdgxgLglg9mABAQwDYHdkE8DOAKADwEpEBvAKESsQCcBTKEGpUSWBRPEi632hpkgIBuStQC+5SeQgIcUFBmw4AciFSpEAXkWZceMOtQkA9CcQxIcGvWiIoWAA51teIA

leushkin commented 4 years ago

was fixed here: 4f76f15ff4f308a427b8487671e4dc5f2d5dc69c