Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions semanticdb/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SemanticDB

To run the tests use two terminals. In the first terminal compile the
`semanticdb/input` project whenever sources change in
`semanticdb/input/src/main/scala/**.scala`.

```
cd semanticdb/input
sbt
> compile
```

In the second terminal, run `sbt dotty-semanticdb/test` from the main dotty
build

```
sbt
> dotty-semanticdb/test
```

The tests assert that the TASTy to SemanticDB converter produces the same output
as the semanticdb-scalac compiler plugin. Test failures result in diffs like
this

```diff
Test dotty.semanticdb.Tests.testExample failed: java.lang.AssertionError:
--- tasty
+++ scala2
-class Example {
- val a: String = "1"
+class Example /*example/Example#*/ {
+ val a /*example/Example#a.*/ : String /*scala/Predef.String#*/ = "1"
```

The lines starting with `-` are the output from the TASTy converter and the
lines starting with `+` are the output from the semanticdb-scalac compiler
plugin.

Once the TASTy converter is updated to emit correct `SymbolOccurrence`
(https://scalameta.org/docs/semanticdb/specification.html#symboloccurrence) then
the "tasty" output should become identical to "scala2" and include inline
comments `class Example /* pkg/Example# */`. The inline comments are read as:
"the symbol `pkg/Example#` was resolved next to the class name `Example`".

The spec for SemanticDB symbols can be found here:

- Scala symbols:
https://scalameta.org/docs/semanticdb/specification.html#scala-symbol
- Java symbols:
https://scalameta.org/docs/semanticdb/specification.html#java-symbol