ballerina-platform / nballerina

Ballerina compiler that generates native executables.
https://ballerina.io/
Apache License 2.0
138 stars 46 forks source link

Make complement op for function type explicit #1220

Open heshanpadmasiri opened 1 year ago

heshanpadmasiri commented 1 year ago

Currently, we are using bddSubtypeComplement (ref) as the complement operation for function types. Furthermore, the function type represents its parameters as a read-only tuple. ~Therefore when we take the complement for a function type we calculate the parameter type by removing the parameter type from all list types. This is wrong and we must instead use the set of all read-only tuples as the top type for parameters.~

Edit: above statement is wrong since function parameters are contravariant. Therefore "top type" for parameters is NEVER. Therefore current implementation is technically correct. But it may still be worth it to make the function top type explicit.