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
6565 val appendDiagnostics = phaseMode == ExtractSemanticDB .PhaseMode .AppendDiagnostics
6666 if (appendDiagnostics)
6767 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))
8178 }
79+ }.asJava.parallelStream().forEach { case (out, warnings) =>
80+ ExtractSemanticDB .appendDiagnostics(warnings, out)
8281 }
8382 else
8483 val writeSemanticdbText = ctx.settings.semanticdbText.value
Original file line number Diff line number Diff line change @@ -3887,9 +3887,9 @@ Occurrences:
38873887[40:10..40:18): rightVar -> local4
38883888
38893889Diagnostics:
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
38933893
38943894Synthetics:
38953895[5:6..5:10):Some => *.unapply[Int]
You can’t perform that action at this time.
0 commit comments