Skip to content

Commit ea3c688

Browse files
committed
Make explicit arguments for context bounds an error from 3.5
1 parent 5189e68 commit ea3c688

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,5 @@ class ReTyper(nestingLevel: Int = 0) extends Typer(nestingLevel) with ReChecking
182182
override protected def checkEqualityEvidence(tree: tpd.Tree, pt: Type)(using Context): Unit = ()
183183
override protected def matchingApply(methType: MethodOrPoly, pt: FunProto)(using Context): Boolean = true
184184
override protected def typedScala2MacroBody(call: untpd.Tree)(using Context): Tree = promote(call)
185+
override protected def migrate[T](migration: => T, disabled: => T = ()): T = disabled
185186
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
183183
// Overridden in derived typers
184184
def newLikeThis(nestingLevel: Int): Typer = new Typer(nestingLevel)
185185

186+
// Overridden to do nothing in derived typers
187+
protected def migrate[T](migration: => T, disabled: => T = ()): T = migration
188+
186189
/** Find the type of an identifier with given `name` in given context `ctx`.
187190
* @param name the name of the identifier
188191
* @param pt the expected type
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
class C[T]
3+
def foo[X: C] = ()
4+
5+
given [T]: C[T] = C[T]()
6+
7+
def Test =
8+
foo(C[Int]()) // warning
9+
foo(using C[Int]()) // ok

0 commit comments

Comments
 (0)