Skip to content

Commit 043c9b4

Browse files
committed
fixed tests
1 parent 103ed7c commit 043c9b4

File tree

9 files changed

+16
-14
lines changed

9 files changed

+16
-14
lines changed

compiler/src/dotty/tools/dotc/quoted/QuoteContextImpl.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext:
20492049
object TypeBounds extends TypeBoundsModule:
20502050
def apply(low: Type, hi: Type): TypeBounds = Types.TypeBounds(low, hi)
20512051
def unapply(x: TypeBounds): Option[(Type, Type)] = Some((x.low, x.hi))
2052+
def minmax = TypeBounds(defn.NothingClass.tree.tpe, defn.AnyClass.tree.tpe)
20522053
end TypeBounds
20532054

20542055
object TypeBoundsMethodsImpl extends TypeBoundsMethods:

library/src/scala/tasty/Reflection.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,6 +2297,7 @@ trait Reflection { reflection =>
22972297
trait TypeBoundsModule { this: TypeBounds.type =>
22982298
def apply(low: Type, hi: Type): TypeBounds
22992299
def unapply(x: TypeBounds): Option[(Type, Type)]
2300+
def minmax: TypeBounds
23002301
}
23012302

23022303
given TypeBoundsMethods as TypeBoundsMethods = TypeBoundsMethodsImpl

tests/neg-staging/i5941/macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object Lens {
1717
import util._
1818
// obj.copy(field = value)
1919
def setterBody(obj: Expr[S], value: Expr[T], field: String): Expr[S] =
20-
Select.overloaded(obj.unseal, "copy", Nil, NamedArg(field, value.unseal) :: Nil).seal.cast[S]
20+
Select.overloaded(obj.unseal, "copy", Nil, NamedArg(field, value.unseal) :: Nil, TypeBounds.minmax).seal.cast[S]
2121

2222
// exception: getter.unseal.underlyingArgument
2323
getter.unseal match {
@@ -51,4 +51,4 @@ object GenLens {
5151
class MkGenLens[S] {
5252
inline def apply[T](get: => (S => T)): Lens[S, T] = ${ Lens.impl('get) }
5353
}
54-
}
54+
}

tests/pos-macros/i6535/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object scalatest {
1212
case t @ Apply(Select(lhs, op), rhs :: Nil) =>
1313
let(lhs) { left =>
1414
let(rhs) { right =>
15-
val app = Select.overloaded(left, op, Nil, right :: Nil)
15+
val app = Select.overloaded(left, op, Nil, right :: Nil, TypeBounds.minmax)
1616
let(app) { result =>
1717
val l = left.seal
1818
val r = right.seal

tests/run-macros/i5941/macro_1.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object Lens {
1919
def setterBody(obj: Term, value: Term, parts: List[String]): Term = {
2020
// o.copy(field = value)
2121
def helper(obj: Term, value: Term, field: String): Term =
22-
Select.overloaded(obj, "copy", Nil, NamedArg(field, value) :: Nil)
22+
Select.overloaded(obj, "copy", Nil, NamedArg(field, value) :: Nil, TypeBounds.minmax)
2323

2424
parts match {
2525
case field :: Nil => helper(obj, value, field)
@@ -118,7 +118,7 @@ object Iso {
118118
// (p: S) => p._1
119119
val to = (p: S) => ${ Select.unique(('p).unseal, "_1").seal.cast[A] }
120120
// (p: A) => S(p)
121-
val from = (p: A) => ${ Select.overloaded(Ident(companion), "apply", Nil, ('p).unseal :: Nil).seal.cast[S] }
121+
val from = (p: A) => ${ Select.overloaded(Ident(companion), "apply", Nil, ('p).unseal :: Nil, TypeBounds.minmax).seal.cast[S] }
122122
apply(from)(to)
123123
}
124124
}
@@ -147,7 +147,7 @@ object Iso {
147147
case TypeRef(prefix, name) => TermRef(prefix, name)
148148
}
149149

150-
val obj = Select.overloaded(Ident(companion), "apply", Nil, Nil).seal.cast[S]
150+
val obj = Select.overloaded(Ident(companion), "apply", Nil, Nil, TypeBounds.minmax).seal.cast[S]
151151

152152
'{
153153
Iso[S, 1](Function.const($obj))(Function.const(1))
@@ -217,4 +217,4 @@ object GenPrism {
217217
* }(jstr => jstr)
218218
*/
219219
inline def apply[S, A <: S]: Prism[S, A] = ${ Prism.impl[S, A] }
220-
}
220+
}

tests/run-macros/i6171/Macro_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object scalatest {
1616
case t @ Apply(Select(lhs, op), rhs :: Nil) =>
1717
let(lhs) { left =>
1818
let(rhs) { right =>
19-
val app = Select.overloaded(left, op, Nil, right :: Nil)
19+
val app = Select.overloaded(left, op, Nil, right :: Nil, TypeBounds.minmax)
2020
let(app) { result =>
2121
val l = left.seal
2222
val r = right.seal
@@ -30,7 +30,7 @@ object scalatest {
3030
if isImplicitMethodType(f.tpe) =>
3131
let(lhs) { left =>
3232
let(rhs) { right =>
33-
val app = Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil)
33+
val app = Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil, TypeBounds.minmax)
3434
let(Apply(app, implicits)) { result =>
3535
val l = left.seal
3636
val r = right.seal

tests/run-macros/reflect-pos-fun/assert_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object scalatest {
1212
case t @ Apply(TypeApply(Select(lhs, op), targs), rhs) =>
1313
let(lhs) { left =>
1414
lets(rhs) { rs =>
15-
val app = Select.overloaded(left, op, targs.map(_.tpe), rs)
15+
val app = Select.overloaded(left, op, targs.map(_.tpe), rs, TypeBounds.minmax)
1616
val b = app.seal.cast[Boolean]
1717
'{ scala.Predef.assert($b) }.unseal
1818
}

tests/run-macros/reflect-select-constructor/assert_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object scalatest {
1616
case t @ Apply(Select(lhs, op), rhs :: Nil) =>
1717
let(lhs) { left =>
1818
let(rhs) { right =>
19-
val app = Select.overloaded(left, op, Nil, right :: Nil)
19+
val app = Select.overloaded(left, op, Nil, right :: Nil, TypeBounds.minmax)
2020
let(app) { result =>
2121
val l = left.seal
2222
val r = right.seal
@@ -30,7 +30,7 @@ object scalatest {
3030
if isImplicitMethodType(f.tpe) =>
3131
let(lhs) { left =>
3232
let(rhs) { right =>
33-
val app = Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil)
33+
val app = Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil, TypeBounds.minmax)
3434
let(Apply(app, implicits)) { result =>
3535
val l = left.seal
3636
val r = right.seal

tests/run-macros/reflect-select-value-class/assert_1.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object scalatest {
1616
case t @ Apply(Select(lhs, op), rhs :: Nil) =>
1717
let(lhs) { left =>
1818
let(rhs) { right =>
19-
val app = Select.overloaded(left, op, Nil, right :: Nil)
19+
val app = Select.overloaded(left, op, Nil, right :: Nil, TypeBounds.minmax)
2020
let(app) { result =>
2121
val l = left.seal
2222
val r = right.seal
@@ -30,7 +30,7 @@ object scalatest {
3030
if isImplicitMethodType(f.tpe) =>
3131
let(lhs) { left =>
3232
let(rhs) { right =>
33-
val app = Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil)
33+
val app = Select.overloaded(Apply(qual, left :: Nil), op, Nil, right :: Nil, TypeBounds.minmax)
3434
let(Apply(app, implicits)) { result =>
3535
val l = left.seal
3636
val r = right.seal

0 commit comments

Comments
 (0)