consider instantiation errors in overload resolution as type mismatch #24098
+118
−26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs #24086
Instantiation errors encountered during overload resolution (such as when instantiating array range expressions based on existing generic parameters) are now saved for the current overload until overload resolution is finished and no overloads match, instead of immediately erroring globally. Encountering such errors also now treats the overload as non-matching. This allows other overloads that would instantiate normally to match even when no generic parameters are given.
Unfortunately I couldn't think of any tests that would encounter the errors created in
semtypinst
as the handling oftyFromExpr
already doesn't create any errors. This doesn't give a great error message either, but going out of our way to error insemtypinst
might make things worse.Note: Covers #10220 but not #22964, which errors when calling
generateTypeInstance
ingetInstantiatedType
, which could also be handled. If we ever fix param constraints with instantiations, we should also handle this, which currently crashes the compiler:In general this paves the way for generic instantiations to fail on constraint mismatches.