Skip to content

Commit bbb4087

Browse files
committed
Rename scala.implicits.Not to scala.util.Not
Having a package just for this type seems weird, especially since we no longer call them "implicits". After discussion it was deemed not useful enough to go in the root scala package, so `scala.util` it is.
1 parent d5efc05 commit bbb4087

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ class Definitions {
738738
@tu lazy val TypeBox_CAP: TypeSymbol = TypeBoxClass.requiredType(tpnme.CAP)
739739

740740
@tu lazy val MatchCaseClass: ClassSymbol = requiredClass("scala.internal.MatchCase")
741-
@tu lazy val NotClass: ClassSymbol = requiredClass("scala.implicits.Not")
741+
@tu lazy val NotClass: ClassSymbol = requiredClass("scala.util.Not")
742742
@tu lazy val Not_value: Symbol = NotClass.companionModule.requiredMethod(nme.value)
743743

744744
@tu lazy val ValueOfClass: ClassSymbol = requiredClass("scala.ValueOf")

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ trait Implicits:
12341234
|According to the new implicit resolution rules this is no longer possible;
12351235
|the search will fail with a global ambiguity error instead.
12361236
|
1237-
|Consider using the scala.implicits.Not class to implement similar functionality.""",
1237+
|Consider using the scala.util.Not class to implement similar functionality.""",
12381238
ctx.source.atSpan(span))
12391239

12401240
/** A relation that influences the order in which implicits are tried.

docs/docs/reference/changed-features/implicit-resolution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ which means that the alternative `c` would be chosen as solution!
107107
Scala 2's somewhat puzzling behavior with respect to ambiguity has been exploited to implement
108108
the analogue of a "negated" search in implicit resolution, where a query `Q1` fails if some
109109
other query `Q2` succeeds and `Q1` succeeds if `Q2` fails. With the new cleaned up behavior
110-
these techniques no longer work. But there is now a new special type `scala.implicits.Not`
110+
these techniques no longer work. But there is now a new special type `scala.util.Not`
111111
which implements negation directly. For any query type `Q`: `Not[Q]` succeeds if and only if
112112
the implicit search for `Q` fails.
113113

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package scala
2+
3+
package object implicits {
4+
@deprecated("scala.implicits.Not has been renamed scala.util.Not", "0.27.0")
5+
type Not[A] = scala.util.Not[A]
6+
}

library/src/scala/implicits/Not.scala renamed to library/src-bootstrapped/scala/util/Not.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scala.implicits
1+
package scala.util
22

33
/** A special class used to implement negation in implicit search.
44
*

0 commit comments

Comments
 (0)