Skip to content

Fix #7048: PCP heal path dependent types #7386

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 1 commit into from
Oct 26, 2019

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Oct 8, 2019

  • Allow path dependent type if their prefix is statically known. As in '[p.X] where p is statically known and therefore is phase consistent.
  • Type heal path dependent type with paths that are not phase consistent. As in '{ val x: p.X = ... } where p is not phase consistent but there is a given Type[p.X] in scope.

@nicolasstucki nicolasstucki force-pushed the fix-#7048-2 branch 3 times, most recently from 5f695f5 to 77081ec Compare October 8, 2019 13:53
@nicolasstucki nicolasstucki marked this pull request as ready for review October 8, 2019 14:57
@nicolasstucki nicolasstucki requested review from odersky and liufengyun and removed request for odersky and liufengyun October 8, 2019 14:57
def isStaticPathOK(tp1: Type): Boolean = tp1 match {
case tp1: TypeRef => tp1.symbol.is(Package) || isStaticPathOK(tp1.prefix)
case tp1: TermRef => tp1.symbol.isStaticOwner || isStaticPathOK(tp1.prefix)
case tp1: ThisType => tp1.tref.symbol.is(Package) || tp1.tref.symbol.is(Module)
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "porjection"

I don't think this is the right logic for isStaticPathOK. How about:

tp1.stripTypeVar match
  case tp1: TypeRef => tp1.symbol.is(Package) || isStaticPathOK(tp1.prefix)
  case tp1: TermRef => tp1.symbol.is(Module) && tp1.symbol.isStatic
  case tp1: ThisType => tp1.cls.isStaticOwner
  case tp1: AppliedType => isStaticPathOK(tp1.tycon)

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 used this version it but made a couple of extra changes to make all the tests pass

@odersky odersky assigned nicolasstucki and unassigned odersky Oct 9, 2019
@nicolasstucki nicolasstucki force-pushed the fix-#7048-2 branch 4 times, most recently from c1c8ead to fc99492 Compare October 11, 2019 12:31
@odersky odersky merged commit d2db509 into scala:master Oct 26, 2019
@odersky odersky deleted the fix-#7048-2 branch October 26, 2019 12:29
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