-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c796bcf
commit de46c7d
Showing
26 changed files
with
188 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Error: tests/neg/given-loop-prevention.scala:10:36 ------------------------------------------------------------------ | ||
10 | given List[Foo] = List(summon[Foo]) // error | ||
| ^ | ||
| Result of implicit search for Foo will change. | ||
| Current result Baz.given_Foo will be no longer eligible | ||
| because it is not defined before the search position. | ||
| Result with new rules: No Matching Implicit. | ||
| To opt into the new rules, compile with `-source future` or use | ||
| the `scala.language.future` language import. | ||
| | ||
| To fix the problem without the language import, you could try one of the following: | ||
| - use a `given ... with` clause as the enclosing given, | ||
| - rearrange definitions so that Baz.given_Foo comes earlier, | ||
| - use an explicit argument. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
class Foo | ||
|
||
object Bar { | ||
given Foo with {} | ||
given List[Foo] = List(summon[Foo]) // ok | ||
} | ||
|
||
object Baz { | ||
given List[Foo] = List(summon[Foo]) // error | ||
given Foo with {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- Error: tests/neg/i7294.scala:7:10 ----------------------------------------------------------------------------------- | ||
7 | case x: T => x.g(10) // error // error | ||
| ^ | ||
| Result of implicit search for scala.reflect.TypeTest[Nothing, T] will change. | ||
| Current result foo.f will be no longer eligible | ||
| because it is not defined before the search position. | ||
| Result with new rules: No Matching Implicit. | ||
| To opt into the new rules, compile with `-source future` or use | ||
| the `scala.language.future` language import. | ||
| | ||
| To fix the problem without the language import, you could try one of the following: | ||
| - use a `given ... with` clause as the enclosing given, | ||
| - rearrange definitions so that foo.f comes earlier, | ||
| - use an explicit argument. | ||
| | ||
| where: T is a type in given instance f with bounds <: foo.Foo | ||
-- [E007] Type Mismatch Error: tests/neg/i7294.scala:7:18 -------------------------------------------------------------- | ||
7 | case x: T => x.g(10) // error // error | ||
| ^^^^^^^ | ||
| Found: Any | ||
| Required: T | ||
| | ||
| where: T is a type in given instance f with bounds <: foo.Foo | ||
| | ||
| longer explanation available when compiling with `-explain` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
package foo | ||
|
||
trait Foo { def g(x: Any): Any } | ||
|
||
inline given f[T <: Foo]: T = ??? match { | ||
case x: T => x.g(10) // error // error | ||
} | ||
|
||
@main def Test = f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
-- Error: tests/neg/looping-givens.scala:9:22 -------------------------------------------------------------------------- | ||
9 | given aa: A = summon // error | ||
| ^ | ||
| Result of implicit search for T will change. | ||
| Current result ab will be no longer eligible | ||
| because it is not defined before the search position. | ||
| Result with new rules: a. | ||
| To opt into the new rules, compile with `-source future` or use | ||
| the `scala.language.future` language import. | ||
| | ||
| To fix the problem without the language import, you could try one of the following: | ||
| - use a `given ... with` clause as the enclosing given, | ||
| - rearrange definitions so that ab comes earlier, | ||
| - use an explicit argument. | ||
| | ||
| where: T is a type variable with constraint <: A | ||
-- Error: tests/neg/looping-givens.scala:10:22 ------------------------------------------------------------------------- | ||
10 | given bb: B = summon // error | ||
| ^ | ||
| Result of implicit search for T will change. | ||
| Current result ab will be no longer eligible | ||
| because it is not defined before the search position. | ||
| Result with new rules: b. | ||
| To opt into the new rules, compile with `-source future` or use | ||
| the `scala.language.future` language import. | ||
| | ||
| To fix the problem without the language import, you could try one of the following: | ||
| - use a `given ... with` clause as the enclosing given, | ||
| - rearrange definitions so that ab comes earlier, | ||
| - use an explicit argument. | ||
| | ||
| where: T is a type variable with constraint <: B | ||
-- Error: tests/neg/looping-givens.scala:11:28 ------------------------------------------------------------------------- | ||
11 | given ab: (A & B) = summon // error | ||
| ^ | ||
| Result of implicit search for T will change. | ||
| Current result ab will be no longer eligible | ||
| because it is not defined before the search position. | ||
| Result with new rules: Search Failure: joint(ab, ab). | ||
| To opt into the new rules, compile with `-source future` or use | ||
| the `scala.language.future` language import. | ||
| | ||
| To fix the problem without the language import, you could try one of the following: | ||
| - use a `given ... with` clause as the enclosing given, | ||
| - rearrange definitions so that ab comes earlier, | ||
| - use an explicit argument. | ||
| | ||
| where: T is a type variable with constraint <: A & B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//> options -source 3.4 | ||
|
||
class A | ||
class B | ||
|
||
given joint(using a: A, b: B): (A & B) = ??? | ||
|
||
def foo(using a: A, b: B) = | ||
given aa: A = summon // error | ||
given bb: B = summon // error | ||
given ab: (A & B) = summon // error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import collection.mutable | ||
|
||
class MaxSizeMap[K, V](maxSize: Int)(using o: Ordering[K]): | ||
val sortedMap: mutable.TreeMap[K, V] = mutable.TreeMap.empty[K, V](o) | ||
val sortedMap: mutable.TreeMap[K, V] = mutable.TreeMap.empty[K, V](using o) | ||
|
||
export sortedMap._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
//> using options -source 3.4 | ||
|
||
import scala.language.implicitConversions | ||
|
||
|
Oops, something went wrong.