Skip to content

Fix unclear "cannot uniquely infer foreach argument types" diagnostic - #23780

Open
usefahmed07 wants to merge 2 commits into
dlang:masterfrom
usefahmed07:fix-foreach-infer-19465
Open

Fix unclear "cannot uniquely infer foreach argument types" diagnostic#23780
usefahmed07 wants to merge 2 commits into
dlang:masterfrom
usefahmed07:fix-foreach-infer-19465

Conversation

@usefahmed07

Copy link
Copy Markdown
Contributor

Fixes #19465

…es' diagnostic

Add supplemental error messages explaining why no opApply overload
matched a foreach statement's parameters (parameter count mismatch,
qualifier/mutability mismatch, or explicit type mismatch), instead of
the previous generic error with no further detail.

The added diagnostics are only printed when no more specific error
(e.g. ambiguous overload match) was already reported for the same
failure, to avoid duplicating existing diagnostics.
…es' diagnostic

Add supplemental error messages explaining why no opApply overload
matched a foreach statement's parameters (parameter count mismatch,
qualifier/mutability mismatch, or explicit type mismatch), instead of
the previous generic error with no further detail.

The added diagnostics are only printed when no more specific error
(e.g. ambiguous overload match) was already reported for the same
failure, to avoid duplicating existing diagnostics.
@usefahmed07

Copy link
Copy Markdown
Contributor Author

@thewilsonator

@thewilsonator thewilsonator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise looks fine

Comment thread compiler/src/dmd/opover.d
if (!p.type)
continue;
Parameter param = tdg.parameterList[u];
if (!p.type.equals(param.type))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (p.type.equals(param.type))
    continue;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cannot uniquely infer foreach argument types is not a descriptive message

2 participants