Skip to content
New issue

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

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

Already on GitHub? # to your account

Set the inlining phase in the Context used for checking macro trees #20087

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

jchyb
Copy link
Contributor

@jchyb jchyb commented Apr 4, 2024

Fixes #17009
The problem here was with the sub typing check for line.split(" ").nn, which needed to confirm that:

(?2 : Array[String]) & Array[String]  <:  (?1 : Array[String]) & Array[String]

TypeComparer would eventually try to compare two skolem types:

(?2 : Array[String]) <: (?1 : Array[String])

The behavior of TypeComparer differs here when executed during the typer phase, where it always returns false for two skolem types, without checking the sub typing further. This makes sense for Typer, but not so much for the macro checks, which for transparent inlines end up being executed during Typer. I think the best solution here is to artificially change the phase in the checkingContext, so the checks done for transparent and non-transparent macros are the same.

@jchyb jchyb requested a review from nicolasstucki April 5, 2024 08:25
@nicolasstucki nicolasstucki merged commit b8fb81b into scala:main Apr 5, 2024
19 checks passed
@nicolasstucki nicolasstucki deleted the fix-i17009 branch April 5, 2024 09:24
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur added a commit that referenced this pull request Jul 5, 2024
…ro trees" to LTS (#21032)

Backports #20087 to the LTS branch.

PR submitted by the release tooling.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copying block in macro with valdef with explicit null expression cause error with -XcheckMacro (regression)
3 participants