@@ -32,10 +32,23 @@ import dotty.tools.dotc.semanticdb.DiagnosticOps.*
32
32
/** Extract symbol references and uses to semanticdb files.
33
33
* See https://scalameta.org/docs/semanticdb/specification.html#symbol-1
34
34
* for a description of the format.
35
+ *
36
+ * Here, we define two phases for "ExtractSemanticDB", "PostTyper" and "PostInlining".
37
+ *
38
+ * The "PostTyper" phase extracts SemanticDB information such as symbol
39
+ * definitions, symbol occurrences, type information, and synthetics.
40
+ * This phase does not write the information to a .semanticdb file;
41
+ * instead, it attaches the SemanticDB information to the top-level tree.
42
+ *
43
+ * The "PostInlining" phase extracts diagnostics from "ctx.reporter" and
44
+ * attaches them to the SemanticDB information extracted in the "PostTyper" phase.
45
+ * Afterwards, it writes the SemanticDB to a ".semanticdb" file.
46
+ * We need to run this phase after the "CheckUnused.PostInlining" phase
47
+ * so that we can extract the warnings generated by "-Wunused".
35
48
*/
36
49
class ExtractSemanticDB private (phaseMode : ExtractSemanticDB .PhaseMode , suffix : String , _key : Property .Key [TextDocument ]) extends Phase :
37
50
38
- override def phaseName : String = ExtractSemanticDB .phaseNamePrefix + suffix
51
+ override val phaseName : String = ExtractSemanticDB .phaseNamePrefix + suffix
39
52
40
53
override val description : String = ExtractSemanticDB .description
41
54
@@ -55,7 +68,7 @@ class ExtractSemanticDB private (phaseMode: ExtractSemanticDB.PhaseMode, suffix:
55
68
unit.tpdTree.putAttachment(_key, extractor.toTextDocument(unit.source))
56
69
else
57
70
unit.tpdTree.getAttachment(_key) match
58
- case None => ???
71
+ case None =>
59
72
case Some (doc) =>
60
73
val warnings = ctx.reporter.allWarnings.collect {
61
74
case w if w.pos.source == ctx.source => w.toSemanticDiagnostic
0 commit comments