Skip to content

Commit 28b461f

Browse files
committed
Fix some tests
1 parent ec64c09 commit 28b461f

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

docs/blog/_posts/2017-12-01-fifth-dotty-milestone-release.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ which means that the alternative `c` would be chosen as solution!
5252
Scala 2's somewhat puzzling behavior with respect to ambiguity has been exploited to implement
5353
the analogue of a "negated" search in implicit resolution, where a query `Q1` fails if some other
5454
query `Q2` succeeds and `Q1` succeeds if `Q2` fails. With the new cleaned up behavior these
55-
techniques no longer work. But there is now a new special type `scala.implicits.Not` which
56-
implements negation directly. For any query type `Q`: `Not[Q]` succeeds if and only if the
55+
techniques no longer work. But there is now a new special type `scala.util.NotGiven` which
56+
implements negation directly. For any query type `Q`: `NotGiven[Q]` succeeds if and only if the
5757
implicit search for `Q` fails.
5858

5959
### Dependent function types [#3464](https://github.com/lampepfl/dotty/pull/3464)

tests/neg-macros/i9972/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package notmacro
22

3-
import scala.util.Not
3+
import scala.util.NotGiven
44

55
object Main extends App {
6-
summon[Not[T[Int]]] // error
6+
summon[NotGiven[T[Int]]] // error
77
}

tests/neg-macros/i9972b/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22
def test: Unit =
3-
summon[scala.util.Not[T[Int]]] // error
3+
summon[scala.util.NotGiven[T[Int]]] // error

tests/neg/i5234a.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
object Test {
2-
import scala.util.Not
2+
import scala.util.NotGiven
33

44
class Foo
55
class Bar
66
implicit def foo: Foo = ???
77
implicitly[Foo]
8-
implicitly[Not[Foo]] // error
9-
implicitly[Not[Bar]]
8+
implicitly[NotGiven[Foo]] // error
9+
implicitly[NotGiven[Bar]]
1010
}

tests/neg/i5234b.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
final class Not2[T] private ()
1+
final class NotGiven2[T] private ()
22

3-
trait LowPriorityNot2 {
3+
trait LowPriorityNotGiven2 {
44

55
/** A fallback method used to emulate negation in Scala 2 */
6-
implicit def default[T]: Not2[T] = Not2.value.asInstanceOf[Not2[T]]
6+
implicit def default[T]: NotGiven2[T] = NotGiven2.value.asInstanceOf[NotGiven2[T]]
77
}
8-
object Not2 extends LowPriorityNot2 {
8+
object NotGiven2 extends LowPriorityNotGiven2 {
99

10-
/** A value of type `Not` to signal a successful search for `Not[C]` (i.e. a failing
10+
/** A value of type `NotGiven` to signal a successful search for `NotGiven[C]` (i.e. a failing
1111
* search for `C`). A reference to this value will be explicitly constructed by
1212
* Dotty's implicit search algorithm
1313
*/
14-
def value: Not2[Nothing] = new Not2[Nothing]()
14+
def value: NotGiven2[Nothing] = new NotGiven2[Nothing]()
1515

1616
/** One of two ambiguous methods used to emulate negation in Scala 2 */
17-
implicit def amb1[T](implicit ev: T): Not2[T] = ???
17+
implicit def amb1[T](implicit ev: T): NotGiven2[T] = ???
1818

1919
/** One of two ambiguous methods used to emulate negation in Scala 2 */
20-
implicit def amb2[T](implicit ev: T): Not2[T] = ???
20+
implicit def amb2[T](implicit ev: T): NotGiven2[T] = ???
2121
}
2222

2323
object Test {
2424
class Foo
2525
class Bar
2626
implicit def foo: Foo = ???
2727
implicitly[Foo]
28-
implicitly[Not2[Foo]] // error
29-
implicitly[Not2[Bar]]
28+
implicitly[NotGiven2[Foo]] // error
29+
implicitly[NotGiven2[Bar]]
3030
}

tests/neg/i5234c.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
object Test {
2-
import scala.util.Not
2+
import scala.util.NotGiven
33

44
class Foo
55
implicit def foo: Foo = ???
66

7-
def foo[T](implicit ev: Not[T]) = ???
7+
def foo[T](implicit ev: NotGiven[T]) = ???
88
foo[Foo] // error
99
}

tests/run/i3396.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import scala.util.Not
1+
import scala.util.NotGiven
22

33
object Test {
44

@@ -9,7 +9,7 @@ object Test {
99
implicit def fooDefault[A]: Foo[A] = Foo(true)
1010
}
1111
object Foo extends FooLowPrio {
12-
implicit def fooNotTagged[A](implicit ev: Not[Tagged[A]]): Foo[A] = Foo(false)
12+
implicit def fooNotTagged[A](implicit ev: NotGiven[Tagged[A]]): Foo[A] = Foo(false)
1313
}
1414

1515

0 commit comments

Comments
 (0)