Skip to content

Commit b2500e8

Browse files
Merge pull request #5268 from olafurpg/semanticdb
Add readme for SemanticDB directory
2 parents ceafaed + 0538936 commit b2500e8

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

semanticdb/readme.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# SemanticDB
2+
3+
To run the tests use two terminals. In the first terminal compile the
4+
`semanticdb/input` project whenever sources change in
5+
`semanticdb/input/src/main/scala/**.scala`.
6+
7+
```
8+
cd semanticdb/input
9+
sbt
10+
> compile
11+
```
12+
13+
In the second terminal, run `sbt dotty-semanticdb/test` from the main dotty
14+
build
15+
16+
```
17+
sbt
18+
> dotty-semanticdb/test
19+
```
20+
21+
The tests assert that the TASTy to SemanticDB converter produces the same output
22+
as the semanticdb-scalac compiler plugin. Test failures result in diffs like
23+
this
24+
25+
```diff
26+
Test dotty.semanticdb.Tests.testExample failed: java.lang.AssertionError:
27+
--- tasty
28+
+++ scala2
29+
-class Example {
30+
- val a: String = "1"
31+
+class Example /*example/Example#*/ {
32+
+ val a /*example/Example#a.*/ : String /*scala/Predef.String#*/ = "1"
33+
```
34+
35+
The lines starting with `-` are the output from the TASTy converter and the
36+
lines starting with `+` are the output from the semanticdb-scalac compiler
37+
plugin.
38+
39+
Once the TASTy converter is updated to emit correct `SymbolOccurrence`
40+
(https://scalameta.org/docs/semanticdb/specification.html#symboloccurrence) then
41+
the "tasty" output should become identical to "scala2" and include inline
42+
comments `class Example /* pkg/Example# */`. The inline comments are read as:
43+
"the symbol `pkg/Example#` was resolved next to the class name `Example`".
44+
45+
The spec for SemanticDB symbols can be found here:
46+
47+
- Scala symbols:
48+
https://scalameta.org/docs/semanticdb/specification.html#scala-symbol
49+
- Java symbols:
50+
https://scalameta.org/docs/semanticdb/specification.html#java-symbol

0 commit comments

Comments
 (0)