-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Simplify Tasty Trees #4277
Conversation
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.
5fc60d4
to
55c917d
Compare
tests/pos/TastyADT.scala
Outdated
} | ||
object NoSymbol extends Symbol | ||
|
||
trait Definition { |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
tests/pos/TastyADT.scala
Outdated
@@ -202,6 +197,8 @@ object tasty { | |||
object ErasedImplicitMethodType extends SpecializedMethodTypeCompanion | |||
|
|||
case class TypeBounds(loBound: Type, hiBound: Type) | |||
case class NoPrefix() | |||
object NoPrefix extends NoPrefix |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.