Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: lenient type checking involving type parameter types (#916)
Related to #915 ### Summary of Changes As described in #915, the code ``` fun f<T>(p: (a: T) -> b: String) pipeline myPipeline { // Expected type '(a: T) -> (b: String)' but got '(a: String) -> (result: String)' f((a: Int) -> a); } ``` currently shows an error due to a parameter mismatch (contravariant context). In a covariant context (e.g. for results), however, no such error is shown. That's because when checking whether a type `T1` can be assigned to a type `T2`, we used to replace a type parameter type as `T1` with its **upper** bound (strict) and as `T2` with its upper bound (lenient). We now instead replace a type parameter as `T1` with its **lower** bound (lenient). This simply checks whether there are any substitutions for `T1` that could let the subtype relation become true.
- Loading branch information