You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, this diagnostic isn't covered yet Errors.TYPE_INFERENCE_UPPER_BOUND_VIOLATED for type-proofs
Given this code example:
fun <A: @Given Semigroup<A>> List<A>.collapse(
initial:A,
f: @Given() (A) ->A = given() // here ::id is injected
): A=
fold(initial) { acc:A, a:A->
acc.combine(f(a))
}
@Given
internalfun <A> id(a:A): A= a
val result =listOf("Hello ", "is it me", "your looking for").collapse(String.empty())
Compilation reads 2 errors:
error found: /var/folders/qq/0zkljkj12jb9m0jnwftykyd00000gn/T/Kotlin-Compilation3131983258667752054/sources/Source.kt: (17, 63): Type parameter bound for A in fun <A : Semigroup> List.collapse(initial: A, f: (A) -> A = ...): A
is not satisfied: inferred type String is not a subtype of Semigroup
When looking into the constraint system regarding type inference. One would need to recreate a ConstraintSystem where the Proof from A -> Semigroup<A> or more concretely String -> Semigroup<String> is provided such that String and Semigroup<String> are both Subtypes of A. Evidently, as one can go from String to Semigroup.
The constraint system allows a rebuild with new constraints, or other manipulations and after that one needs to check for isSuccessful.
That can be done, among other ways, in Analysis through suppressing Diagnostics or with the storageComponent and manipulating the constraint system manually.
Please check if by supplying a successful constraint system the second error will be resolved, too. If not then SyntheticResolution needs to be reviewed.
I am leaving it here in case someone want's to pick it up.
The text was updated successfully, but these errors were encountered:
Currently, this diagnostic isn't covered yet
Errors.TYPE_INFERENCE_UPPER_BOUND_VIOLATED
for type-proofsGiven this code example:
Compilation reads 2 errors:
is not satisfied: inferred type String is not a subtype of Semigroup
the current constraint system only contains these constraints:
When looking into the constraint system regarding type inference. One would need to recreate a ConstraintSystem where the Proof from
A -> Semigroup<A>
or more concretelyString -> Semigroup<String>
is provided such thatString
andSemigroup<String>
are both Subtypes of A. Evidently, as one can go from String to Semigroup.The constraint system allows a rebuild with new constraints, or other manipulations and after that one needs to check for
isSuccessful
.That can be done, among other ways, in Analysis through suppressing Diagnostics or with the storageComponent and manipulating the constraint system manually.
Please check if by supplying a successful constraint system the second error will be resolved, too. If not then SyntheticResolution needs to be reviewed.
I am leaving it here in case someone want's to pick it up.
The text was updated successfully, but these errors were encountered: