Skip to content

Use scala.reflect.TypeTest in Reflection #10305

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

Merged
merged 6 commits into from
Nov 14, 2020

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

3 unsoundess issues found by TypeTest in the reflection API marked with FIXME.
@nicolasstucki nicolasstucki marked this pull request as ready for review November 13, 2020 15:43
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

override def unapply(x: Any): Option[PackageClause] = x match
case x: tpd.PackageDef @unchecked => Some(x)
def unapply(x: Tree): Option[PackageClause & x.type] = x match
case x: (tpd.PackageDef & x.type) => Some(x)
Copy link
Contributor

Choose a reason for hiding this comment

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

Digression: it seems to be a good case for flow-sensitive isInstanceOf.

@nicolasstucki nicolasstucki merged commit a4ba3bd into scala:master Nov 14, 2020
@nicolasstucki nicolasstucki deleted the use-type-test-in-reflect branch November 14, 2020 06:54
@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.

4 participants