You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add -quickfix compiler option to apply quick fixes to source files
With 2.13.12 the compiler starts providing quick fixes with certain
warnings and errors. Typically these are presented in IDEs, however
it can also be practical to have the compiler directly patch the source
files.
From `-quickfix:help`:
```
Apply quick fixes provided by the compiler for warnings and errors to source files.
Syntax: -quickfix:<filter>,...,<filter>
<filter> syntax is the same as for configurable warnings, see `-Wconf:help`. Examples:
-quickfix:any apply all available quick fixes
-quickfix:msg=Auto-application apply quick fixes where the message contains "Auto-application"
Use `-Wconf:any:warning-verbose` to display applicable message filters with each warning.
```
} if (!sup.used &&!sup.synthetic) issueWarning(Message.Plain(sup.annotPos, "@nowarn annotation does not suppress any warnings", WarningCategory.UnusedNowarn, "", Nil))
valnowarn=BooleanSetting ("-nowarn", "Generate no warnings.") withAbbreviation "--no-warnings" withPostSetHook { s =>if (s.value) maxwarns.value =0 }
52
52
valoptimise:BooleanSetting// depends on post hook which mutates other settings
53
53
valprint=BooleanSetting ("-print", "Print program with Scala-specific features removed.") withAbbreviation "--print"
54
+
valquickfix=MultiStringSetting(
55
+
"-quickfix",
56
+
"filters",
57
+
"Apply quick fixes provided by the compiler for warnings and errors to source files",
58
+
helpText =Some(
59
+
"""Apply quick fixes provided by the compiler for warnings and errors to source files.
60
+
|Syntax: -quickfix:<filter>,...,<filter>
61
+
|
62
+
|<filter> syntax is the same as for configurable warnings, see `-Wconf:help`. Examples:
63
+
| -quickfix:any apply all available quick fixes
64
+
| -quickfix:msg=Auto-application apply quick fixes where the message contains "Auto-application"
65
+
|
66
+
|Use `-Wconf:any:warning-verbose` to display applicable message filters with each warning.
67
+
|""".stripMargin),
68
+
prepend =true)
54
69
valrelease=
55
70
ChoiceSetting("-release", "release", "Compile for a version of the Java API and target class file.", AllTargetVersions, normalizeTarget(javaSpecVersion))
Copy file name to clipboardExpand all lines: test/files/neg/auto-application.check
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ auto-application.scala:5: error: Int does not take parameters
7
7
auto-application.scala:6: error: Int does not take parameters
8
8
("": Object).##()
9
9
^
10
-
auto-application.scala:9: warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method meth,
10
+
auto-application.scala:9: warning: [quick fix available] Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method meth,
11
11
or remove the empty argument list from its definition (Java-defined methods are exempt).
12
12
In Scala 3, an unapplied method like this will be eta-expanded into a function.
13
13
meth // warn, auto-application (of nilary methods) is deprecated
0 commit comments