Skip to content

Instantly share code, notes, and snippets.

@andiogenes
Created February 18, 2025 07:44
Show Gist options
  • Save andiogenes/521f50d187a749e77e5bdcd63999ee50 to your computer and use it in GitHub Desktop.
Save andiogenes/521f50d187a749e77e5bdcd63999ee50 to your computer and use it in GitHub Desktop.
Comments section of TASTy file
/** ScalaDoc for `object foo`. */
object foo {
/** This ScalaDoc will be listed. */
def foo = 42
// This comment won't be listed
def bar = 43
/** Multi-
* -line
* ScalaDoc.
*/
def baz = 43
}
--------------------------------------------------------------------------------
foo.tasty
--------------------------------------------------------------------------------
Names:
0: ASTs
1: <empty>
2: foo
3: foo[ModuleClass]
4: <init>
5: <init>[Signed Signature(List(),foo$) @<init>]
6: java
7: lang
8: java[Qualified . lang]
9: Object
10: java[Qualified . lang][Qualified . Object]
11: <init>[Signed Signature(List(),java.lang.Object) @<init>]
12: _
13: Unit
14: scala
15: writeReplace
16: AnyRef
17: runtime
18: scala[Qualified . runtime]
19: ModuleSerializationProxy
20: scala[Qualified . runtime][Qualified . ModuleSerializationProxy]
21: Class
22: java[Qualified . lang][Qualified . Class]
23: <init>[Signed Signature(List(java.lang.Class),scala.runtime.ModuleSerializationProxy) @<init>]
24: Int
25: bar
26: baz
27: SourceFile
28: annotation
29: scala[Qualified . annotation]
30: internal
31: scala[Qualified . annotation][Qualified . internal]
32: scala[Qualified . annotation][Qualified . internal][Qualified . SourceFile]
33: String
34: java[Qualified . lang][Qualified . String]
35: <init>[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @<init>]
36: foo.scala
37: Positions
38: Comments
Trees:
start = Addr(0), base = 313, current = Addr(0), end = Addr(125)
125 bytes of AST, base = Addr(0)
0: PACKAGE(123)
2: TERMREFpkg 1 [<empty>]
4: VALDEF(19) 2 [foo]
7: IDENTtpt 3 [foo[ModuleClass]]
9: TYPEREFsymbol 25
11: THIS
12: TYPEREFpkg 1 [<empty>]
14: APPLY(8)
16: SELECTin(6) 5 [<init>[Signed Signature(List(),foo$) @<init>]]
19: NEW
20: SHAREDterm 7
22: SHAREDtype 9
24: OBJECT
25: TYPEDEF(98) 3 [foo[ModuleClass]]
28: TEMPLATE(76)
30: APPLY(10)
32: SELECTin(8) 11 [<init>[Signed Signature(List(),java.lang.Object) @<init>]]
35: NEW
36: TYPEREF 9 [Object]
38: TERMREFpkg 8 [java[Qualified . lang]]
40: SHAREDtype 36
42: SELFDEF 12 [_]
44: SINGLETONtpt
45: TERMREFsymbol 4
47: SHAREDtype 11
49: DEFDEF(7) 4 [<init>]
52: EMPTYCLAUSE
53: TYPEREF 13 [Unit]
55: TERMREFpkg 14 [scala]
57: STABLE
58: DEFDEF(23) 15 [writeReplace]
61: EMPTYCLAUSE
62: TYPEREF 16 [AnyRef]
64: SHAREDtype 55
66: APPLY(13)
68: SELECTin(8) 23 [<init>[Signed Signature(List(java.lang.Class),scala.runtime.ModuleSerializationProxy) @<init>]]
71: NEW
72: TYPEREF 19 [ModuleSerializationProxy]
74: TERMREFpkg 18 [scala[Qualified . runtime]]
76: SHAREDtype 72
78: CLASSconst
79: SHAREDtype 45
81: PRIVATE
82: SYNTHETIC
83: DEFDEF(7) 2 [foo]
86: TYPEREF 24 [Int]
88: SHAREDtype 55
90: INTconst 42
92: DEFDEF(5) 25 [bar]
95: SHAREDtype 86
97: INTconst 43
99: DEFDEF(5) 26 [baz]
102: SHAREDtype 86
104: INTconst 43
106: OBJECT
107: ANNOTATION(16)
109: TYPEREF 27 [SourceFile]
111: TERMREFpkg 31 [scala[Qualified . annotation][Qualified . internal]]
113: APPLY(10)
115: SELECTin(6) 35 [<init>[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @<init>]]
118: NEW
119: SHAREDtype 109
121: SHAREDtype 109
123: STRINGconst 36 [foo.scala]
125:
98 position bytes:
lines: 15
line sizes: 33, 12, 38, 14, 0, 33, 14, 0, 12, 12, 17, 6, 14, 1, 0
positions:
0: 34 .. 219
4: 34 .. 34
7: 34 .. 34
25: 34 .. 219
28: 88 .. 217
36: 41 .. 41
45: 88 .. 88
49: 88 .. 88
53: 88 .. 88
58: 41 .. 41
62: 41 .. 41
72: 41 .. 41
78: 41 .. 41
83: 88 .. 100
86: 95 .. 95
90: 98 .. 100
92: 138 .. 150
95: 145 .. 145
97: 148 .. 150
99: 205 .. 217
102: 212 .. 212
104: 215 .. 217
113: 34 .. 219
119: 34 .. 34
123: 34 .. 34
source paths:
0: foo.scala
178 comment bytes:
4: /** ScalaDoc for `object foo`. */ (expanded = false)
25: /** ScalaDoc for `object foo`. */ (expanded = false)
83: /** This ScalaDoc will be listed. */ (expanded = false)
99: /** Multi-
* -line
* ScalaDoc.
*/ (expanded = false)
--------------------------------------------------------------------------------
scalac foo.scala
scalac -color:never -print-tasty foo.tasty > foo.tasty.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment