Skip to content

Simplify Tasty Trees #4277

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 5 commits into from
Apr 10, 2018
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 9, 2018

Several simplifications and fixes for tasty trees.

Also: Avoid crash if prefix of selection is higher-kinded
The test case caused a crash in NamedType, because Lambda is higher-kinded.
We now report an error instead.

odersky added 2 commits April 9, 2018 11:42
The test case caused a crash in NamedType, because `Lambda` is higher-kinded.
We now report an error instead.
Several changes mean that quite a bit of boilerplate can be removed. Also, some
fixes.
@odersky odersky changed the title Avoid crash if prefix of selection is higher-kinded Simplify Tasty Trees Apr 9, 2018
@odersky odersky requested a review from nicolasstucki April 9, 2018 11:45
@odersky odersky force-pushed the simplify-tastytrees branch from 5fc60d4 to 55c917d Compare April 9, 2018 12:16
}
object NoSymbol extends Symbol

trait Definition {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should extend Statement

Avoid `Empty` and `Tpt`
case Assign(lhs: Term, rhs: Term)
case Block(stats: List[Statement], expr: Term)
case Inlined(call: Term, bindings: List[Definition], expr: Term)
case Lambda(method: Term, tpt: Term | Empty)
case Lambda(method: Term, tpt: Option[TypeTree])
Copy link
Member

Choose a reason for hiding this comment

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

Why is tpt optional here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, the doc is wrong. https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala#L1022-L1025

The docs should be updated to

LAMBDA         Length meth_Term target_Type?

Copy link
Contributor

Choose a reason for hiding this comment

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

Created #4285 to fix this

@@ -202,6 +197,8 @@ object tasty {
object ErasedImplicitMethodType extends SpecializedMethodTypeCompanion

case class TypeBounds(loBound: Type, hiBound: Type)
case class NoPrefix()
object NoPrefix extends NoPrefix
Copy link
Member

Choose a reason for hiding this comment

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

Why both a class and an object for NoPrefix?

Copy link
Contributor

Choose a reason for hiding this comment

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

To allow NoPrefix to be used in | types and be a singleton at the same time.

@nicolasstucki nicolasstucki merged commit 07fa870 into scala:master Apr 10, 2018
@Blaisorblade Blaisorblade deleted the simplify-tastytrees branch April 10, 2018 05:46
@odersky odersky restored the simplify-tastytrees branch April 17, 2018 13:30
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