Skip to content

Handle some explicit paths in quotes #8113

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

Closed
wants to merge 1 commit into from

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Jan 28, 2020

Towards fixing #8100

This is an extension of #7682 that handles path-dependent types used in lower levels.

@nicolasstucki nicolasstucki self-assigned this Jan 28, 2020
@nicolasstucki nicolasstucki changed the title Fix #8100: Handle explicit paths in quotes Handle some explicit paths in quotes Feb 7, 2020
@nicolasstucki nicolasstucki marked this pull request as ready for review February 7, 2020 09:58
@@ -7,7 +7,7 @@ object Unpickler {

type PickledQuote = List[String]
type PickledExprArgs = Seq[Seq[Any] => ((QuoteContext ?=> Expr[Any]) | Type[_])]
type PickledTypeArgs = Seq[Seq[Any] => Type[_]]
type PickledTypeArgs = Seq[Seq[Any] => ((QuoteContext ?=> Expr[Any]) | Type[_])]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we simplify to only keep PickledArgs, as PickledExprArgs and PickledTypeArgs now have the same definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but there are some bootstrapping constraints.

@@ -179,6 +183,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
case tp: TypeRef =>
if levelOf(sym).getOrElse(0) < level then tryHeal(sym, tp, pos)
else None
case _: TermRef if ctx.mode.is(Mode.Type) && levelOf(sym).getOrElse(0) >= level => None
Copy link
Contributor

@liufengyun liufengyun Feb 10, 2020

Choose a reason for hiding this comment

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

Will it be an issue, if it's used in pattern matching, e.g. case _: p.T? Or, t.asInstanceOf[p.T] can also be problematic.

@@ -100,7 +104,7 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
case Some(tpRef) => tpRef
case _ => tree
}
case _: TypeTree | _: AppliedTypeTree | _: Apply | _: TypeApply | _: UnApply | Select(_, OuterSelectName(_, _)) =>
case _: TypeTree | _: AppliedTypeTree | _: Apply | _: UnApply | Select(_, OuterSelectName(_, _)) =>
tree.withType(checkTp(tree.tpe))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why ignore TypeApply?

@nicolasstucki
Copy link
Contributor Author

Replaced with #8796

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