File tree Expand file tree Collapse file tree 2 files changed +15
-16
lines changed
compiler/src/dotty/tools/dotc/semanticdb Expand file tree Collapse file tree 2 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -65,20 +65,19 @@ class ExtractSemanticDB private (phaseMode: ExtractSemanticDB.PhaseMode) extends
65
65
val appendDiagnostics = phaseMode == ExtractSemanticDB .PhaseMode .AppendDiagnostics
66
66
if (appendDiagnostics)
67
67
val warnings = ctx.reporter.allWarnings.groupBy(w => w.pos.source)
68
- units.map { unit =>
69
- val unitCtx = ctx.fresh.setCompilationUnit(unit).withRootImports
70
- val outputDir =
71
- ExtractSemanticDB .semanticdbPath(
72
- unit.source,
73
- ExtractSemanticDB .outputDirectory(using unitCtx),
74
- sourceRoot
75
- )
76
- val source = unit.source
77
- (outputDir, source)
78
- }.asJava.parallelStream().forEach { case (out, source) =>
79
- warnings.get(source).foreach { ws =>
80
- ExtractSemanticDB .appendDiagnostics(ws.map(_.toSemanticDiagnostic), out)
68
+ units.flatMap { unit =>
69
+ warnings.get(unit.source).map { ws =>
70
+ val unitCtx = ctx.fresh.setCompilationUnit(unit).withRootImports
71
+ val outputDir =
72
+ ExtractSemanticDB .semanticdbPath(
73
+ unit.source,
74
+ ExtractSemanticDB .outputDirectory(using unitCtx),
75
+ sourceRoot
76
+ )
77
+ (outputDir, ws.map(_.toSemanticDiagnostic))
81
78
}
79
+ }.asJava.parallelStream().forEach { case (out, warnings) =>
80
+ ExtractSemanticDB .appendDiagnostics(warnings, out)
82
81
}
83
82
else
84
83
val writeSemanticdbText = ctx.settings.semanticdbText.value
Original file line number Diff line number Diff line change @@ -3887,9 +3887,9 @@ Occurrences:
3887
3887
[40:10..40:18): rightVar -> local4
3888
3888
3889
3889
Diagnostics:
3890
- [30:11..30:18): [warning] unset local variable
3891
- [30:20..30:28): [warning] unset local variable
3892
- [31:15..31:25): [warning] unset local variable
3890
+ [30:11..30:18): [warning] unset local variable, consider using an immutable val instead
3891
+ [30:20..30:28): [warning] unset local variable, consider using an immutable val instead
3892
+ [31:15..31:25): [warning] unset local variable, consider using an immutable val instead
3893
3893
3894
3894
Synthetics:
3895
3895
[5:6..5:10):Some => *.unapply[Int]
You can’t perform that action at this time.
0 commit comments