forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reinstantiate restriction to transparent inline methods
Reverts parts of scala#19922. Fixes scala#20342, scala#20297 The logic that we should ignore declared result types of inline methods really only applies to transparent inlines.
- Loading branch information
Showing
5 changed files
with
63 additions
and
4 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,12 @@ | ||
-- [E172] Type Error: tests/neg/i18123.scala:25:33 --------------------------------------------------------------------- | ||
25 | (charClassIntersection.rep() | classItem.rep()) // error | ||
| ^^^^^^^^^^^^^^^ | ||
|No given instance of type pkg.Implicits.Repeater[pkg.RegexTree, V] was found. | ||
|I found: | ||
| | ||
| pkg.Implicits.Repeater.GenericRepeaterImplicit[T] | ||
| | ||
|But method GenericRepeaterImplicit in object Repeater does not match type pkg.Implicits.Repeater[pkg.RegexTree, V] | ||
| | ||
|where: V is a type variable with constraint <: Seq[pkg.CharClassIntersection] | ||
|. |
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 @@ | ||
// may not compile anymore in Scala 3.4+ | ||
package pkg | ||
|
||
trait P[+T] | ||
|
||
extension [T](inline parse0: P[T]) | ||
inline def | [V >: T](inline other: P[V]): P[V] = ??? | ||
|
||
extension [T](inline parse0: => P[T]) | ||
inline def rep[V](inline min: Int = 0)(using repeater: Implicits.Repeater[T, V]): P[V] = ??? | ||
|
||
object Implicits: | ||
trait Repeater[-T, R] | ||
object Repeater: | ||
implicit def GenericRepeaterImplicit[T]: Repeater[T, Seq[T]] = ??? | ||
|
||
sealed trait RegexTree | ||
abstract class Node extends RegexTree | ||
class CharClassIntersection() extends Node | ||
|
||
def classItem: P[RegexTree] = ??? | ||
def charClassIntersection: P[CharClassIntersection] = ??? | ||
|
||
def x = | ||
(charClassIntersection.rep() | classItem.rep()) // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
sealed abstract class Kyo[+T, -S] | ||
opaque type <[+T, -S] >: T = T | Kyo[T, S] | ||
|
||
extension [T, S](v: T < S) | ||
inline def map[U, S2](inline f: T => U < S2): U < (S & S2) = ??? | ||
|
||
class Streams[V] | ||
object Streams: | ||
def emitValue[V](v: V): Unit < Streams[V] = ??? | ||
|
||
opaque type Stream[+T, V, -S] = T < (Streams[V] & S) | ||
object Stream: | ||
extension [T, V, S](s: Stream[T, V, S]) | ||
def reemit[S2, V2](f: V => Unit < (Streams[V2] & S2)): Stream[T, V2, S & S2] = ??? | ||
def filter[S2](f: V => Boolean < S2): Stream[T, V, S & S2] = reemit { v => | ||
f(v).map { | ||
case false => () | ||
case true => Streams.emitValue(v) | ||
} | ||
} |