Skip to content

Remove reflect refinement form nested quotes #10456

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

Conversation

nicolasstucki
Copy link
Contributor

This refinement is unsound as the nested reflect is not the same as the outer one.

In theory we could make it work by using the refinement

type Nested = QuoteContext {
  type Tree >: self.reflect.Tree
  ...
}

This refinement is unfortunately too large for the compiler to handle.

Removing the refinement forces us to transform trees into Expr before using them in a splice. This is in general a better practice anyway.

@nicolasstucki nicolasstucki marked this pull request as ready for review November 23, 2020 17:46
@nicolasstucki
Copy link
Contributor Author

We could refine this type in a later version which would only allow more programs to type check.

@nicolasstucki nicolasstucki self-assigned this Nov 23, 2020
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

val reflect: self.reflect.type
}
/** Type of a QuoteContext provided by a splice within a quote that took this context. */
type Nested = QuoteContext
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is the case, it seems we can remove this concept?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered it. But if we leave it we can add support for some of those features in a future release. I will look into it later.

@nicolasstucki nicolasstucki force-pushed the remove-reflection-refinement-from-quotes branch 3 times, most recently from 555555f to 2eb4f6a Compare November 24, 2020 16:37
This refinement is unsound as the nested `reflect` is not the same as the outer one.

In theory we could make it work by using the refinement
```
type Nested = Quotes {
  type Tree >: self.reflect.Tree
  ...
}
```
This refinement is unfortunately too large for the compiler to handle.

Removing the refinement forces us to transform trees into `Expr` before using them in a splice. This is in general a better practice anyway.
@nicolasstucki nicolasstucki force-pushed the remove-reflection-refinement-from-quotes branch from 2eb4f6a to 5adfd3a Compare November 24, 2020 17:22
@nicolasstucki nicolasstucki merged commit cbc682f into scala:master Nov 25, 2020
@nicolasstucki nicolasstucki deleted the remove-reflection-refinement-from-quotes branch November 25, 2020 07:51
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

3 participants