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
{{ message }}
Repository navigation
cmd/compile: type inference fails on a case which looks simple #63750
changed the title [-]cmd/compile: type inference failas on a case which looks simple[/-][+]cmd/compile: type inference fails on a case which looks simple[/+]on Oct 26, 2023
Unfortunately we can't do any inference in this case because the constraint C doesn't have a core type.
Closing because this is a known limitation of the language, not an actual bug.
Eventually we need a concrete proposal to move forward.
@dr2chase In both cases, T should be inferred to be int. @go101 What we need to see to move forward with cases like these (type inference) is really good real-life examples where this matters. Functions operating on type parameters which have no core types can't do a whole lot with values of such type parameters.
Activity
[-]cmd/compile: type inference failas on a case which looks simple[/-][+]cmd/compile: type inference fails on a case which looks simple[/+]mauri870 commentedon Oct 26, 2023
/cc @golang/compiler
griesemer commentedon Oct 26, 2023
Unfortunately we can't do any inference in this case because the constraint
Cdoesn't have a core type.Closing because this is a known limitation of the language, not an actual bug.
Eventually we need a concrete proposal to move forward.
dr2chase commentedon Oct 26, 2023
This case would look simpler if it included a comment explaining what was thought to be happening.
griesemer commentedon Oct 26, 2023
@dr2chase In both cases,
Tshould be inferred to beint.@go101 What we need to see to move forward with cases like these (type inference) is really good real-life examples where this matters. Functions operating on type parameters which have no core types can't do a whole lot with values of such type parameters.