Skip to content

fix #24912 #24913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: devel
Choose a base branch
from
Open

fix #24912 #24913

wants to merge 15 commits into from

Conversation

Graveflo
Copy link
Contributor

@Graveflo Graveflo commented Apr 26, 2025

#24912
Although this appears to work as far as I know the method is kinda dumb, frankly. I know the dot expression can have complexities but I have wondered a couple times why the compiler doesn't often transform the call similar to this and toss it into semDirectOp. If anyone cares to enlighten me I'll listen.

Right now this checks for tyTyepDescr explicitly but I'm thinking that it would make more sense to check if the field access is looking at a proc type, but maybe I'll commit again and check that out after I see how this goes.

@Graveflo
Copy link
Contributor Author

Graveflo commented Apr 26, 2025

not technically necessary but I isolated a bit from tparser_generator. Not 100% sure about tyGenericInst here but it doesn't seem to conflict anything else I tried. The type of the field doesn't seem to be explicitly verified this way though, which is a little weird.

@Graveflo
Copy link
Contributor Author

Seems like both the first and the last commits will work for addressing the issue. I think the first commit is a work around, but it is simpler. The last commit delays conversions and semObjConstr until after overload resolution so that properties and such are evaluated first. It also seems to require another copyTree of the input node. Two things that are not free.

I've thought to trial overload resolution before but since it's expensive it has been better to just avoid it. Not this time. I also don't know yet if delaying semConv and semObjConstr adds another asymmetry to dot calls. Personally, I like the last commit better then the first.

# repeat the overload resolution,
# this time enabling all the diagnostic output (this should fail again)
result = semOverloadedCall(c, n, nOrig, filter, flags + {efExplain})
elif efNoUndeclared notin flags:
result = nil
notFoundError(c, n, errors)
if efPreferNilResult notin flags:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe reuse efNoUndeclared instead?

Copy link
Contributor Author

@Graveflo Graveflo May 1, 2025

Choose a reason for hiding this comment

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

I wasn't sure about this one either. Another option might be to pass through errorsEnabled as it is in resolveOverloads and see if disabling the errors with this flag has bad side effects, but that doesn't sound great either. I'll use efNoUndeclared instead if I end up sticking with this.
edit: yea not sure how I missed that one

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.

2 participants