Skip to content

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 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


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