Skip to content

Commit

Permalink
Remove last tweaking use of global.isScala3Migration
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Jul 2, 2023
1 parent ce9b345 commit 93ac153
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/compiler/scala/tools/nsc/Global.scala
Expand Up @@ -1184,7 +1184,6 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
@nowarn("cat=deprecation")
val isScala3: Boolean = settings.isScala3.value
val isScala3ImplicitResolution: Boolean = settings.Yscala3ImplicitResolution.value
val isScala3Migration = settings.Xmigration.value != NoScalaVersion

// used in sbt
def uncheckedWarnings: List[(Position, String)] = reporting.uncheckedWarnings
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
Expand Up @@ -554,8 +554,7 @@ trait NamesDefaults { self: Analyzer =>
val NamedArg(Ident(name), rhs) = arg: @unchecked
params.indexWhere(p => matchesName(p, name, argIndex)) match {
case -1 =>
val warnVariableInScope = (!currentRun.isScala3 || currentRun.isScala3Migration) && context0.lookupSymbol(name, _.isVariable).isSuccess
UnknownParameterNameNamesDefaultError(arg, name, warnVariableInScope)
UnknownParameterNameNamesDefaultError(arg, name, warnVariableInScope = context0.lookupSymbol(name, _.isVariable).isSuccess)
case paramPos if argPos contains paramPos =>
val existingArgIndex = argPos.indexWhere(_ == paramPos)
val otherName = Some(args(paramPos)) collect {
Expand Down
2 changes: 2 additions & 0 deletions test/files/neg/t12798.check
@@ -1,4 +1,6 @@
t12798.scala:11: error: unknown parameter name: z
Note that assignments in argument position are no longer allowed since Scala 2.13.
To express the assignment expression, wrap it in brackets, e.g., `{ z = ... }`.
f(42, z = 27)
^
t12798.scala:25: error: unary prefix operator definition with empty parameter list is unsupported: instead, remove () to declare as `def unary_- = -42`
Expand Down

0 comments on commit 93ac153

Please sign in to comment.