Skip to content

Conversation

HarrisL2
Copy link
Contributor

@HarrisL2 HarrisL2 commented Sep 2, 2025

Fixes #23845

Copy link
Contributor

@olhotak olhotak left a comment

Choose a reason for hiding this comment

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

This is great, thank you! Could you please also add the original test from #23845 (with the macro/Quote)? Otherwise LGTM.

@HarrisL2
Copy link
Contributor Author

HarrisL2 commented Sep 2, 2025

I don't think the macro/quote version of the issue is reproducible in the test setup, but added nonetheless.

@olhotak
Copy link
Contributor

olhotak commented Sep 2, 2025

Ah, OK, good point.

@olhotak olhotak merged commit fbbae09 into scala:main Sep 3, 2025
44 checks passed
case tp1 @ PolyFunctionOf(mt: MethodType) if mt.isContextualMethod =>
tp1
case tp1: FlexibleType =>
asContextFunctionType(tp1.underlying)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I'm missing something here so I do have a question: Why do we drop the information that this was a Flexible Type (FT) instead of wrapping it over FT?

Copy link
Member

Choose a reason for hiding this comment

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

For the purpose here, we only want to extract the information of a context function, so it's ok to widen a flexible type. I would prefer to strip any OrNull/flexible type at the beginning of this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

So do you mean changing

    tp.stripTypeVar.dealias match

to

    tp.stripTypeVar.dealias.stripNull match

at the beginning (instead of adding this case)?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, maybe before stripTypeVar

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.

-Yexplicit-nulls breaks macros expecting Type context bound

4 participants