Skip to content

Commit 760f329

Browse files
committed
Add docs
1 parent 774270c commit 760f329

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/pos/TastyADT.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
object tasty {
22

3+
// ------ Names --------------------------------
4+
35
trait PossiblySignedName
46

57
enum Name extends PossiblySignedName {
@@ -19,12 +21,19 @@ object tasty {
1921

2022
case class SignedName(name: Name, resultSig: Name, paramSigs: List[Name]) extends PossiblySignedName
2123

24+
// ------ Positions ---------------------------
25+
2226
case class Position(firstOffset: Int, lastOffset: Int)
2327

2428
trait Positioned {
2529
def pos: Position = ???
2630
}
2731

32+
// ------ Statements ---------------------------------
33+
34+
// Note: Definitions are written as extractors, because they may be referred to
35+
// recursively from some of their arguments (since we equate symbols with definitions)
36+
2837
trait TopLevelStatement extends Positioned
2938

3039
trait Statement extends TopLevelStatement
@@ -109,6 +118,9 @@ object tasty {
109118

110119
case class Id(name: Name) extends Positioned // untyped ident
111120

121+
// ------ Terms ---------------------------------
122+
123+
/** Trees denoting terms */
112124
enum Term extends Statement {
113125
def tpe: Type = ???
114126
case Ident(name: Name, override val tpe: Type)
@@ -134,6 +146,7 @@ object tasty {
134146
case Tpt(underlying: TypeTerm | Empty)
135147
}
136148

149+
/** Trees denoting types */
137150
enum TypeTerm extends Positioned {
138151
def tpe: Type = ???
139152
case Ident(name: Name, override val tpe: Type)
@@ -148,6 +161,7 @@ object tasty {
148161
case ByName(tpt: TypeTerm)
149162
}
150163

164+
/** Trees denoting patterns */
151165
enum Pattern extends Positioned {
152166
def tpe: Type = ???
153167
case Value(v: Term)
@@ -162,6 +176,8 @@ object tasty {
162176

163177
sealed trait Type
164178

179+
// ------ Types ---------------------------------
180+
165181
object Type {
166182
case class ConstantType(value: Constant) extends Type
167183
case class SymRef(sym: Definition, qualifier: Type | Empty = Empty) extends Type
@@ -178,6 +194,9 @@ object tasty {
178194
case class ParamRef(binder: LambdaType, idx: Int) extends Type
179195
case class RecThis(binder: RecursiveType) extends Type
180196

197+
// The following types are all expressed by extractors because they may be referred
198+
// to from some of their arguments
199+
181200
class RecursiveType(underlyingExp: RecursiveType => Type) extends Type {
182201
val underlying = underlyingExp(this)
183202
}
@@ -236,6 +255,8 @@ object tasty {
236255
case class TypeBounds(loBound: Type, hiBound: Type)
237256
}
238257

258+
// ------ Modifiers ---------------------------------
259+
239260
enum Modifier extends Positioned {
240261
case Private, Protected, Abstract, Final, Sealed, Case, Implicit, Erased, Lazy, Override, Inline,
241262
Macro, // inline method containing toplevel splices
@@ -260,6 +281,8 @@ object tasty {
260281
case Annotation(tree: Term)
261282
}
262283

284+
// ------ Constants ---------------------------------
285+
263286
enum Constant(value: Any) {
264287
case Unit extends Constant(())
265288
case False extends Constant(false)

0 commit comments

Comments
 (0)