Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ object ProtoTypes {
def constrainResult(meth: Symbol, mt: Type, pt: Type)(using Context): Boolean =
if (Inlines.isInlineable(meth)) {
// Stricter behaviour in 3.4+: do not apply `wildApprox` to non-transparent inlines
if (Feature.sourceVersion.isAtLeast(SourceVersion.future)) {
if (Feature.sourceVersion.isAtLeast(SourceVersion.`3.4`)) {
if (meth.is(Transparent)) {
constrainResult(mt, wildApprox(pt))
// do not constrain the result type of transparent inline methods
Expand Down
12 changes: 12 additions & 0 deletions tests/neg-macros/i18174.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- [E172] Type Error: tests/neg-macros/i18174.scala:27:33 --------------------------------------------------------------
27 | (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]
|.
27 changes: 27 additions & 0 deletions tests/neg-macros/i18174.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// does not compile anymore in Scala 3.4+
package pkg

import scala.language.`3.4`

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
2 changes: 2 additions & 0 deletions tests/pos-macros/i18123.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// may not compile anymore in Scala 3.4+
package pkg

import scala.language.`3.3`

trait P[+T]

extension [T](inline parse0: P[T])
Expand Down