motoko icon indicating copy to clipboard operation
motoko copied to clipboard

type operators `and`, `or` are not working right in polymorphic contexts

Open ggreif opened this issue 2 years ago • 1 comments

type Bar<A> = Foo and A

always gives None, even if the A passed in is a record. I didn't test this with or, but I suspect it is equally ignorant with variants in polymorphic context.

ggreif avatar Dec 03 '23 16:12 ggreif

That is expected behaviour – these are just syntactic operators, not full-blown union and intersection types (which would introduce exponential complexity into the type system).

rossberg avatar Dec 04 '23 06:12 rossberg