Skip to content

transparent inline implicit conversion def is called again and again #12394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
soronpo opened this issue May 10, 2021 · 5 comments · Fixed by #12409
Closed

transparent inline implicit conversion def is called again and again #12394

soronpo opened this issue May 10, 2021 · 5 comments · Fixed by #12409
Milestone

Comments

@soronpo
Copy link
Contributor

soronpo commented May 10, 2021

Compiler version

v3.0.0-RC3

Minimized code

Main code:

trait Bla[Of]:
  val value : Of
object Bla : 
  import scala.quoted.*
  transparent inline implicit def conv[Of, From](inline from : From) : Bla[Of] =
    ${convMacro[Of, From]('from)}

  def convMacro[Of, From](from : Expr[From])(using Quotes, Type[Of], Type[From]) : Expr[Bla[Of]] =
    import quotes.reflect._
    val fromTpe = TypeRepr.of[From]
    println(fromTpe.show) //this yields many different weird type printing as the compiler enters again and again
    report.throwError("some error")
    ???

Test code:

import scala.language.implicitConversions
class Bar[T](value : T) 
given [T <: Int] : Conversion[T, Bar[T]] = new Bar(_)
def bar[T](x : Bla[Bar[T]]) = x.value
val b1 = bar(1)

Output

scala.Int
scala.CanEqual[scala.collection.Seq[T], scala.collection.Seq[U]]
scala.CanEqual[scala.collection.Set[T], scala.collection.Set[U]]
scala.reflect.Selectable
scala.Float
scala.Long
scala.Double
scala.collection.Iterable[A]
scala.Float
scala.Double
scala.Double
scala.Int
scala.Long
scala.Float
scala.Double
scala.Long
scala.Float
scala.Short
scala.Double
scala.Int
scala.Function1.UnliftOps[A, B]
scala.Int
scala.Long
scala.Float
scala.Double
scala.collection.Factory[A, scala.Array[A]]
scala.quoted.Type[T]
scala.quoted.FromExpr.ListFromExpr[T]
scala.quoted.FromExpr.Tuple8FromExpr[T1, T2, T3, T4, T5, T6, T7, T8]
scala.quoted.FromExpr.Tuple10FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]
scala.quoted.FromExpr.MapFromExpr[T, U]
scala.quoted.FromExpr.SeqFromExpr[T]
scala.quoted.FromExpr.LeftFromExpr[L, R]
scala.quoted.FromExpr.Tuple4FromExpr[T1, T2, T3, T4]
scala.quoted.FromExpr.OptionFromExpr[T]
scala.quoted.FromExpr.Tuple15FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]
scala.quoted.FromExpr.Tuple1FromExpr[T1]
scala.quoted.FromExpr.Tuple13FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]
scala.quoted.FromExpr.Tuple17FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]
scala.quoted.FromExpr.Tuple12FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]
scala.quoted.FromExpr.Tuple2FromExpr[T1, T2]
scala.quoted.FromExpr.Tuple18FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]
scala.quoted.FromExpr.Tuple6FromExpr[T1, T2, T3, T4, T5, T6]
scala.quoted.FromExpr.Tuple5FromExpr[T1, T2, T3, T4, T5]
scala.quoted.FromExpr.Tuple19FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]
scala.quoted.FromExpr.Tuple7FromExpr[T1, T2, T3, T4, T5, T6, T7]
scala.quoted.FromExpr.Tuple14FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]
scala.quoted.FromExpr.SomeFromExpr[T]
scala.quoted.FromExpr.Tuple9FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9]
scala.quoted.FromExpr.Tuple22FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]
scala.quoted.FromExpr.Tuple11FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]
scala.quoted.FromExpr.Tuple3FromExpr[T1, T2, T3]
scala.quoted.FromExpr.Tuple16FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]
scala.quoted.FromExpr.SetFromExpr[T]
scala.quoted.FromExpr.RightFromExpr[L, R]
scala.quoted.FromExpr.EitherFromExpr[L, R]
scala.quoted.FromExpr.Tuple20FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]
scala.quoted.FromExpr.Tuple21FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]
scala.quoted.Expr[scala.Array[scala.Char]]
scala.quoted.ToExpr.Tuple17ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]
scala.quoted.Expr[scala.Array[scala.Double]]
scala.quoted.ToExpr.Tuple10ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]
scala.quoted.ToExpr.Tuple7ToExpr[T1, T2, T3, T4, T5, T6, T7]
scala.quoted.Expr[scala.Array[scala.Int]]
scala.quoted.ToExpr.Tuple19ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]
scala.quoted.Expr[scala.Array[scala.Long]]
scala.quoted.ToExpr.SeqToExpr[T]
scala.quoted.ToExpr.Tuple1ToExpr[T1]
scala.quoted.Expr[scala.BigInt]
scala.quoted.ToExpr.Tuple9ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9]
scala.quoted.ToExpr.Tuple14ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]
scala.quoted.ToExpr.Tuple16ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]
scala.quoted.Expr[scala.StringContext]
scala.quoted.ToExpr.SomeToExpr[T]
scala.quoted.Expr[scala.BigDecimal]
scala.quoted.ToExpr.ArrayToExpr[T]
scala.quoted.ToExpr.Tuple3ToExpr[T1, T2, T3]
scala.quoted.ToExpr.Tuple6ToExpr[T1, T2, T3, T4, T5, T6]
scala.quoted.ToExpr.LeftToExpr[L, R]
scala.quoted.ToExpr.Tuple22ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]
scala.quoted.ToExpr.Tuple4ToExpr[T1, T2, T3, T4]
scala.quoted.ToExpr.Tuple8ToExpr[T1, T2, T3, T4, T5, T6, T7, T8]
scala.quoted.Expr[scala.Array[scala.Byte]]
scala.quoted.ToExpr.OptionToExpr[T]
scala.quoted.ToExpr.ClassTagToExpr[T]
scala.quoted.ToExpr.Tuple18ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]
scala.quoted.Expr[scala.Nil]
scala.quoted.ToExpr.SetToExpr[T]
scala.quoted.Expr[scala.Array[scala.Float]]
scala.quoted.ToExpr.Tuple11ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]
scala.quoted.ToExpr.Tuple15ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]
scala.quoted.ToExpr.Tuple12ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]
scala.quoted.ToExpr.TupleConsToExpr[H, T]
scala.quoted.ToExpr.MapToExpr[T, U]
scala.quoted.Expr[scala.Tuple$package.EmptyTuple]
scala.quoted.ToExpr.Tuple2ToExpr[T1, T2]
scala.quoted.Expr[scala.Array[scala.Boolean]]
scala.quoted.ToExpr.Tuple13ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]
scala.quoted.ToExpr.Tuple21ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]
scala.quoted.Expr[scala.Array[scala.Short]]
scala.quoted.ToExpr.Tuple5ToExpr[T1, T2, T3, T4, T5]
scala.quoted.ToExpr.IArrayToExpr[T]
scala.quoted.ToExpr.ListToExpr[T]
scala.quoted.ToExpr.RightToExpr[L, R]
scala.quoted.Expr[scala.None]
scala.quoted.ToExpr.Tuple20ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]
scala.quoted.ToExpr.EitherToExpr[L, R]
scala.reflect.Selectable
scala.collection.Iterable[scala.Tuple3[El1, El2, El3]]
scala.collection.Iterable[scala.Tuple2[El1, El2]]
scala.util.NotGiven[T]
scala.util.NotGiven[T]
scala.util.Random
scala.util.ChainingOps[A]
scala.util.Either.MergeableEither[A]
scala.util.control.Exception.Catcher[T]
scala.collection.View[scala.Tuple4[El1, El2, El3, El4]]
scala.reflect.ClassTag[A]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.SortedMap[K, V]]
scala.collection.View[scala.Tuple2[El1, El2]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Buffer[A]]
scala.collection.JavaConverters.AsJava[java.util.Map[K, V]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Set[A]]
scala.collection.JavaConverters.AsJavaCollection[A]
scala.collection.JavaConverters.AsJava[java.util.Set[A]]
scala.collection.JavaConverters.AsJava[java.util.Set[A]]
scala.collection.JavaConverters.AsJavaDictionary[K, V]
scala.collection.JavaConverters.AsScala[scala.collection.Iterable[A]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Map[K, V]]
scala.collection.JavaConverters.AsJava[java.util.List[A]]
scala.collection.JavaConverters.AsJava[java.util.concurrent.ConcurrentMap[K, V]]
scala.collection.JavaConverters.AsJava[java.util.Iterator[A]]
scala.collection.JavaConverters.AsJava[java.util.List[A]]
scala.collection.JavaConverters.AsJava[java.util.List[A]]
scala.collection.JavaConverters.AsJava[java.util.Map[K, V]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Map[scala.Predef.String, scala.Predef.String]]
scala.collection.JavaConverters.AsScala[scala.collection.Iterator[A]]
scala.collection.JavaConverters.AsScala[scala.collection.concurrent.Map[K, V]]
scala.collection.JavaConverters.AsJava[java.lang.Iterable[A]]
scala.collection.JavaConverters.AsJavaEnumeration[A]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Map[K, V]]
scala.collection.JavaConverters.AsScala[scala.collection.Iterable[A]]
scala.collection.JavaConverters.AsScala[scala.collection.Iterator[A]]
scala.collection.Factory[scala.Tuple2[K, V], CC[K, V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[K, V], CC[K, V]]
scala.collection.Factory[scala.Tuple2[K, V], CC[K, V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[K, V], CC[K, V]]
scala.collection.IterableOnceExtensionMethods[A]
scala.collection.Factory[A, CC[A]]
scala.collection.BuildFrom[scala.Any, A, CC[A]]
scala.collection.Factory[A, CC[A]]
scala.collection.BuildFrom[scala.Any, A, CC[A]]
scala.collection.View[scala.Tuple3[El1, El2, El3]]
scala.collection.Searching.SearchImpl[Repr, scala.Nothing]
scala.collection.Factory[A, scala.collection.SortedSet[A]]
scala.collection.BuildFrom[CC[A0], A, CC[A]]
scala.collection.BuildFrom[scala.Array[_ >: scala.Nothing <: scala.Any], A, scala.Array[A]]
scala.collection.BuildFrom[CC[K0, V0], scala.Tuple2[K, V], CC[K, V]]
scala.collection.Factory[A, scala.Array[A]]
scala.collection.immutable.WrappedString.UnwrapOp
scala.collection.immutable.LazyList.Deferrer[A]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.immutable.SortedMap[K, V]]
scala.collection.Factory[A, scala.collection.immutable.SortedSet[A]]
scala.collection.Factory[A, scala.collection.immutable.TreeSet[A]]
scala.collection.Factory[A, scala.collection.immutable.ArraySeq[A]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.immutable.TreeMap[K, V]]
scala.collection.Factory[scala.Tuple2[scala.collection.immutable.LongMapUtils.Long, V], scala.collection.immutable.LongMap[V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[scala.collection.immutable.LongMapUtils.Long, V], scala.collection.immutable.LongMap[V]]
scala.collection.Factory[scala.Tuple2[scala.collection.immutable.IntMapUtils.Int, V], scala.collection.immutable.IntMap[V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[scala.collection.immutable.IntMapUtils.Int, V], scala.collection.immutable.IntMap[V]]
scala.collection.immutable.Stream.Deferrer[A]
scala.collection.generic.IsIterableOnce[Repr] {
  type A >: scala.collection.generic.IsIterable[Repr] & scala.Singleton.A <: scala.collection.generic.IsIterable[Repr] & scala.Singleton.A
}
scala.collection.generic.IsIterable[Repr] {
  type A >: scala.collection.generic.IsSeq[Repr] & scala.Singleton.A <: scala.collection.generic.IsSeq[Repr] & scala.Singleton.A
  type C >: scala.collection.generic.IsSeq[Repr] & scala.Singleton.C <: scala.collection.generic.IsSeq[Repr] & scala.Singleton.C
}
scala.collection.generic.IsIterable[Repr] {
  type A >: scala.collection.generic.IsMap[Repr] & scala.Singleton.A <: scala.collection.generic.IsMap[Repr] & scala.Singleton.A
  type C >: scala.collection.generic.IsMap[Repr] & scala.Singleton.C <: scala.collection.generic.IsMap[Repr] & scala.Singleton.C
}
scala.collection.generic.IsSeq[scala.Array[A0]] {
  type A >: A0 <: A0
  type C >: scala.Array[A0] <: scala.Array[A0]
}
scala.collection.Factory[A, scala.collection.mutable.PriorityQueue[A]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.SortedMap[K, V]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.AnyRefMap[K, V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[K, V], scala.collection.mutable.AnyRefMap[K, V]]
scala.collection.Factory[A, scala.collection.mutable.SortedSet[A]]
scala.collection.Factory[A, scala.collection.mutable.TreeSet[A]]
scala.collection.Factory[A, scala.collection.mutable.UnrolledBuffer[A]]
scala.collection.Factory[A, scala.collection.mutable.ArraySeq[A]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.CollisionProofHashMap[K, V]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.TreeMap[K, V]]
scala.collection.Factory[scala.Tuple2[scala.Long, V], scala.collection.mutable.LongMap[V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[scala.Long, V], scala.collection.mutable.LongMap[V]]
scala.math.Integral[T].IntegralOps
scala.math.Ordering[scala.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
scala.math.Ordering[A]
scala.math.Ordering[scala.Option[T]]
scala.math.Ordering[scala.Tuple6[T1, T2, T3, T4, T5, T6]]
scala.math.Ordering[scala.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
scala.math.Ordering[scala.collection.Iterable[T]]
scala.math.Ordering[scala.Tuple2[T1, T2]]
scala.math.Ordering[scala.Tuple3[T1, T2, T3]]
scala.math.Ordering[scala.Tuple5[T1, T2, T3, T4, T5]]
scala.math.Ordering[scala.Tuple4[T1, T2, T3, T4]]
scala.math.Ordering[scala.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
scala.math.Ordering[A]
scala.math.Ordering[CC[T]]
scala.math.Ordering[CC[T]]
scala.math.Ordering[T].OrderingOps
scala.math.Ordering.Unit.OrderingOps
scala.math.Ordering.Boolean.OrderingOps
scala.math.Ordering.Byte.OrderingOps
scala.math.Ordering.Char.OrderingOps
scala.math.Ordering.Short.OrderingOps
scala.math.Ordering.Int.OrderingOps
scala.math.Ordering.Long.OrderingOps
scala.math.Ordering.Float.TotalOrdering.OrderingOps
scala.math.Ordering.Float.IeeeOrdering.OrderingOps
scala.math.Ordering.DeprecatedFloatOrdering.OrderingOps
scala.math.Ordering.Double.TotalOrdering.OrderingOps
scala.math.Ordering.Double.IeeeOrdering.OrderingOps
scala.math.Ordering.DeprecatedDoubleOrdering.OrderingOps
scala.math.Ordering.BigInt.OrderingOps
scala.math.Ordering.BigDecimal.OrderingOps
scala.math.Ordering.String.OrderingOps
scala.math.Ordering.Symbol.OrderingOps
scala.math.Numeric[T].NumericOps
scala.math.Numeric.BigIntIsIntegral.OrderingOps
scala.math.Numeric.BigIntIsIntegral.IntegralOps
scala.math.Numeric.IntIsIntegral.OrderingOps
scala.math.Numeric.IntIsIntegral.IntegralOps
scala.math.Numeric.ShortIsIntegral.OrderingOps
scala.math.Numeric.ShortIsIntegral.IntegralOps
scala.math.Numeric.ByteIsIntegral.OrderingOps
scala.math.Numeric.ByteIsIntegral.IntegralOps
scala.math.Numeric.CharIsIntegral.OrderingOps
scala.math.Numeric.CharIsIntegral.IntegralOps
scala.math.Numeric.LongIsIntegral.OrderingOps
scala.math.Numeric.LongIsIntegral.IntegralOps
scala.math.Numeric.FloatIsFractional.OrderingOps
scala.math.Numeric.FloatIsFractional.FractionalOps
scala.math.Numeric.DoubleIsFractional.OrderingOps
scala.math.Numeric.DoubleIsFractional.FractionalOps
scala.math.Numeric.BigDecimalIsFractional.OrderingOps
scala.math.Numeric.BigDecimalIsFractional.FractionalOps
scala.math.Numeric.BigDecimalAsIfIntegral.OrderingOps
scala.math.Numeric.BigDecimalAsIfIntegral.IntegralOps
scala.math.Equiv[scala.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
scala.math.Equiv[scala.Option[T]]
scala.math.Equiv[scala.Tuple6[T1, T2, T3, T4, T5, T6]]
scala.math.Equiv[scala.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
scala.math.Equiv[scala.Tuple2[T1, T2]]
scala.math.Equiv[scala.Tuple3[T1, T2, T3]]
scala.math.Equiv[scala.Tuple5[T1, T2, T3, T4, T5]]
scala.math.Equiv[scala.Tuple4[T1, T2, T3, T4]]
scala.math.Equiv[scala.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
scala.math.Equiv[CC[T]]
scala.math.Equiv[CC[T]]
scala.math.BigInt
scala.math.BigInt
scala.math.BigInt
scala.math.Fractional[T].FractionalOps
scala.math.BigDecimal
scala.math.BigDecimal
scala.math.BigDecimal
scala.math.BigDecimal
scala.math.BigDecimal.RoundingMode.ValueOrdering.OrderingOps
scala.math.Ordered[T]
scala.CanEqual[scala.collection.Seq[T], scala.collection.Seq[U]]
scala.CanEqual[scala.collection.Set[T], scala.collection.Set[U]]
scala.reflect.Selectable
scala.Float
scala.Long
scala.Double
scala.collection.Iterable[A]
scala.Float
scala.Double
scala.Double
scala.Int
scala.Long
scala.Float
scala.Double
scala.Long
scala.Float
scala.Short
scala.Double
scala.Int
scala.Function1.UnliftOps[A, B]
scala.Int
scala.Long
scala.Float
scala.Double
scala.collection.Factory[A, scala.Array[A]]
scala.quoted.Type[T]
scala.quoted.FromExpr.ListFromExpr[T]
scala.quoted.FromExpr.Tuple8FromExpr[T1, T2, T3, T4, T5, T6, T7, T8]
scala.quoted.FromExpr.Tuple10FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]
scala.quoted.FromExpr.MapFromExpr[T, U]
scala.quoted.FromExpr.SeqFromExpr[T]
scala.quoted.FromExpr.LeftFromExpr[L, R]
scala.quoted.FromExpr.Tuple4FromExpr[T1, T2, T3, T4]
scala.quoted.FromExpr.OptionFromExpr[T]
scala.quoted.FromExpr.Tuple15FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]
scala.quoted.FromExpr.Tuple1FromExpr[T1]
scala.quoted.FromExpr.Tuple13FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]
scala.quoted.FromExpr.Tuple17FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]
scala.quoted.FromExpr.Tuple12FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]
scala.quoted.FromExpr.Tuple2FromExpr[T1, T2]
scala.quoted.FromExpr.Tuple18FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]
scala.quoted.FromExpr.Tuple6FromExpr[T1, T2, T3, T4, T5, T6]
scala.quoted.FromExpr.Tuple5FromExpr[T1, T2, T3, T4, T5]
scala.quoted.FromExpr.Tuple19FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]
scala.quoted.FromExpr.Tuple7FromExpr[T1, T2, T3, T4, T5, T6, T7]
scala.quoted.FromExpr.Tuple14FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]
scala.quoted.FromExpr.SomeFromExpr[T]
scala.quoted.FromExpr.Tuple9FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9]
scala.quoted.FromExpr.Tuple22FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]
scala.quoted.FromExpr.Tuple11FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]
scala.quoted.FromExpr.Tuple3FromExpr[T1, T2, T3]
scala.quoted.FromExpr.Tuple16FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]
scala.quoted.FromExpr.SetFromExpr[T]
scala.quoted.FromExpr.RightFromExpr[L, R]
scala.quoted.FromExpr.EitherFromExpr[L, R]
scala.quoted.FromExpr.Tuple20FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]
scala.quoted.FromExpr.Tuple21FromExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]
scala.quoted.Expr[scala.Array[scala.Char]]
scala.quoted.ToExpr.Tuple17ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]
scala.quoted.Expr[scala.Array[scala.Double]]
scala.quoted.ToExpr.Tuple10ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]
scala.quoted.ToExpr.Tuple7ToExpr[T1, T2, T3, T4, T5, T6, T7]
scala.quoted.Expr[scala.Array[scala.Int]]
scala.quoted.ToExpr.Tuple19ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]
scala.quoted.Expr[scala.Array[scala.Long]]
scala.quoted.ToExpr.SeqToExpr[T]
scala.quoted.ToExpr.Tuple1ToExpr[T1]
scala.quoted.Expr[scala.BigInt]
scala.quoted.ToExpr.Tuple9ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9]
scala.quoted.ToExpr.Tuple14ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]
scala.quoted.ToExpr.Tuple16ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]
scala.quoted.Expr[scala.StringContext]
scala.quoted.ToExpr.SomeToExpr[T]
scala.quoted.Expr[scala.BigDecimal]
scala.quoted.ToExpr.ArrayToExpr[T]
scala.quoted.ToExpr.Tuple3ToExpr[T1, T2, T3]
scala.quoted.ToExpr.Tuple6ToExpr[T1, T2, T3, T4, T5, T6]
scala.quoted.ToExpr.LeftToExpr[L, R]
scala.quoted.ToExpr.Tuple22ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]
scala.quoted.ToExpr.Tuple4ToExpr[T1, T2, T3, T4]
scala.quoted.ToExpr.Tuple8ToExpr[T1, T2, T3, T4, T5, T6, T7, T8]
scala.quoted.Expr[scala.Array[scala.Byte]]
scala.quoted.ToExpr.OptionToExpr[T]
scala.quoted.ToExpr.ClassTagToExpr[T]
scala.quoted.ToExpr.Tuple18ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]
scala.quoted.Expr[scala.Nil]
scala.quoted.ToExpr.SetToExpr[T]
scala.quoted.Expr[scala.Array[scala.Float]]
scala.quoted.ToExpr.Tuple11ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]
scala.quoted.ToExpr.Tuple15ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]
scala.quoted.ToExpr.Tuple12ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]
scala.quoted.ToExpr.TupleConsToExpr[H, T]
scala.quoted.ToExpr.MapToExpr[T, U]
scala.quoted.Expr[scala.Tuple$package.EmptyTuple]
scala.quoted.ToExpr.Tuple2ToExpr[T1, T2]
scala.quoted.Expr[scala.Array[scala.Boolean]]
scala.quoted.ToExpr.Tuple13ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]
scala.quoted.ToExpr.Tuple21ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]
scala.quoted.Expr[scala.Array[scala.Short]]
scala.quoted.ToExpr.Tuple5ToExpr[T1, T2, T3, T4, T5]
scala.quoted.ToExpr.IArrayToExpr[T]
scala.quoted.ToExpr.ListToExpr[T]
scala.quoted.ToExpr.RightToExpr[L, R]
scala.quoted.Expr[scala.None]
scala.quoted.ToExpr.Tuple20ToExpr[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]
scala.quoted.ToExpr.EitherToExpr[L, R]
scala.reflect.Selectable
scala.collection.Iterable[scala.Tuple3[El1, El2, El3]]
scala.collection.Iterable[scala.Tuple2[El1, El2]]
scala.util.NotGiven[T]
scala.util.NotGiven[T]
scala.util.Random
scala.util.ChainingOps[A]
scala.util.Either.MergeableEither[A]
scala.util.control.Exception.Catcher[T]
scala.io.Codec
scala.io.Codec
scala.io.Codec
scala.collection.View[scala.Tuple4[El1, El2, El3, El4]]
scala.reflect.ClassTag[A]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.SortedMap[K, V]]
scala.collection.View[scala.Tuple2[El1, El2]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Buffer[A]]
scala.collection.JavaConverters.AsJava[java.util.Map[K, V]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Set[A]]
scala.collection.JavaConverters.AsJavaCollection[A]
scala.collection.JavaConverters.AsJava[java.util.Set[A]]
scala.collection.JavaConverters.AsJava[java.util.Set[A]]
scala.collection.JavaConverters.AsJavaDictionary[K, V]
scala.collection.JavaConverters.AsScala[scala.collection.Iterable[A]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Map[K, V]]
scala.collection.JavaConverters.AsJava[java.util.List[A]]
scala.collection.JavaConverters.AsJava[java.util.concurrent.ConcurrentMap[K, V]]
scala.collection.JavaConverters.AsJava[java.util.Iterator[A]]
scala.collection.JavaConverters.AsJava[java.util.List[A]]
scala.collection.JavaConverters.AsJava[java.util.List[A]]
scala.collection.JavaConverters.AsJava[java.util.Map[K, V]]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Map[scala.Predef.String, scala.Predef.String]]
scala.collection.JavaConverters.AsScala[scala.collection.Iterator[A]]
scala.collection.JavaConverters.AsScala[scala.collection.concurrent.Map[K, V]]
scala.collection.JavaConverters.AsJava[java.lang.Iterable[A]]
scala.collection.JavaConverters.AsJavaEnumeration[A]
scala.collection.JavaConverters.AsScala[scala.collection.mutable.Map[K, V]]
scala.collection.JavaConverters.AsScala[scala.collection.Iterable[A]]
scala.collection.JavaConverters.AsScala[scala.collection.Iterator[A]]
scala.collection.Factory[scala.Tuple2[K, V], CC[K, V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[K, V], CC[K, V]]
scala.collection.Factory[scala.Tuple2[K, V], CC[K, V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[K, V], CC[K, V]]
scala.collection.IterableOnceExtensionMethods[A]
scala.collection.Factory[A, CC[A]]
scala.collection.BuildFrom[scala.Any, A, CC[A]]
scala.collection.Factory[A, CC[A]]
scala.collection.BuildFrom[scala.Any, A, CC[A]]
scala.collection.View[scala.Tuple3[El1, El2, El3]]
scala.collection.Searching.SearchImpl[Repr, scala.Nothing]
scala.collection.Factory[A, scala.collection.SortedSet[A]]
scala.collection.BuildFrom[CC[A0], A, CC[A]]
scala.collection.BuildFrom[scala.Array[_ >: scala.Nothing <: scala.Any], A, scala.Array[A]]
scala.collection.BuildFrom[CC[K0, V0], scala.Tuple2[K, V], CC[K, V]]
scala.collection.Factory[A, scala.Array[A]]
scala.collection.Iterator[A]
scala.collection.mutable.Map[K, V]
scala.collection.concurrent.Map[K, V]
scala.collection.mutable.Set[A]
scala.collection.mutable.Map[K, V]
scala.collection.mutable.Map[scala.Predef.String, scala.Predef.String]
scala.collection.Iterable[A]
scala.collection.Iterator[A]
scala.collection.mutable.Buffer[A]
scala.collection.Iterable[A]
java.util.Collection[A]
scala.collection.Iterator[A]
java.util.Set[A]
scala.collection.mutable.Map[K, V]
java.util.Dictionary[K, V]
scala.collection.mutable.Map[K, V]
java.util.Map[K, V]
java.lang.Iterable[A]
java.util.List[A]
java.util.Map[K, V]
java.util.concurrent.ConcurrentMap[K, V]
java.util.Enumeration[A]
scala.collection.concurrent.Map[K, V]
java.util.List[A]
scala.collection.mutable.Set[A]
java.util.Iterator[A]
java.util.Set[A]
scala.collection.mutable.Map[scala.Predef.String, scala.Predef.String]
java.util.List[A]
scala.collection.Iterable[A]
scala.collection.Iterator[A]
scala.collection.mutable.Buffer[A]
scala.collection.Iterable[A]
java.util.Collection[A]
java.util.Set[A]
java.util.Dictionary[K, V]
java.util.Enumeration[A]
java.util.List[A]
java.util.Map[K, V]
java.lang.Iterable[A]
java.util.List[A]
java.util.List[A]
java.util.Map[K, V]
java.util.concurrent.ConcurrentMap[K, V]
java.util.Iterator[A]
java.util.Set[A]
scala.collection.immutable.WrappedString.UnwrapOp
scala.collection.immutable.LazyList.Deferrer[A]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.immutable.SortedMap[K, V]]
scala.collection.Factory[A, scala.collection.immutable.SortedSet[A]]
scala.collection.Factory[A, scala.collection.immutable.TreeSet[A]]
scala.collection.Factory[A, scala.collection.immutable.ArraySeq[A]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.immutable.TreeMap[K, V]]
scala.collection.Factory[scala.Tuple2[scala.collection.immutable.LongMapUtils.Long, V], scala.collection.immutable.LongMap[V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[scala.collection.immutable.LongMapUtils.Long, V], scala.collection.immutable.LongMap[V]]
scala.collection.Factory[scala.Tuple2[scala.collection.immutable.IntMapUtils.Int, V], scala.collection.immutable.IntMap[V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[scala.collection.immutable.IntMapUtils.Int, V], scala.collection.immutable.IntMap[V]]
scala.collection.immutable.Stream.Deferrer[A]
scala.collection.generic.IsIterableOnce[Repr] {
  type A >: scala.collection.generic.IsIterable[Repr] & scala.Singleton.A <: scala.collection.generic.IsIterable[Repr] & scala.Singleton.A
}
scala.collection.generic.IsIterable[Repr] {
  type A >: scala.collection.generic.IsSeq[Repr] & scala.Singleton.A <: scala.collection.generic.IsSeq[Repr] & scala.Singleton.A
  type C >: scala.collection.generic.IsSeq[Repr] & scala.Singleton.C <: scala.collection.generic.IsSeq[Repr] & scala.Singleton.C
}
scala.collection.generic.IsIterable[Repr] {
  type A >: scala.collection.generic.IsMap[Repr] & scala.Singleton.A <: scala.collection.generic.IsMap[Repr] & scala.Singleton.A
  type C >: scala.collection.generic.IsMap[Repr] & scala.Singleton.C <: scala.collection.generic.IsMap[Repr] & scala.Singleton.C
}
scala.collection.generic.IsSeq[scala.Array[A0]] {
  type A >: A0 <: A0
  type C >: scala.Array[A0] <: scala.Array[A0]
}
scala.collection.Factory[A, scala.collection.mutable.PriorityQueue[A]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.SortedMap[K, V]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.AnyRefMap[K, V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[K, V], scala.collection.mutable.AnyRefMap[K, V]]
scala.collection.Factory[A, scala.collection.mutable.SortedSet[A]]
scala.collection.Factory[A, scala.collection.mutable.TreeSet[A]]
scala.collection.Factory[A, scala.collection.mutable.UnrolledBuffer[A]]
scala.collection.Factory[A, scala.collection.mutable.ArraySeq[A]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.CollisionProofHashMap[K, V]]
scala.collection.Factory[scala.Tuple2[K, V], scala.collection.mutable.TreeMap[K, V]]
scala.collection.Factory[scala.Tuple2[scala.Long, V], scala.collection.mutable.LongMap[V]]
scala.collection.BuildFrom[scala.Any, scala.Tuple2[scala.Long, V], scala.collection.mutable.LongMap[V]]
scala.math.Integral[T].IntegralOps
scala.math.Ordering[scala.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
scala.math.Ordering[A]
scala.math.Ordering[scala.Option[T]]
scala.math.Ordering[scala.Tuple6[T1, T2, T3, T4, T5, T6]]
scala.math.Ordering[scala.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
scala.math.Ordering[scala.collection.Iterable[T]]
scala.math.Ordering[scala.Tuple2[T1, T2]]
scala.math.Ordering[scala.Tuple3[T1, T2, T3]]
scala.math.Ordering[scala.Tuple5[T1, T2, T3, T4, T5]]
scala.math.Ordering[scala.Tuple4[T1, T2, T3, T4]]
scala.math.Ordering[scala.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
scala.math.Ordering[A]
scala.math.Ordering[CC[T]]
scala.math.Ordering[CC[T]]
scala.math.Ordering[T].OrderingOps
scala.math.Ordering.Unit.OrderingOps
scala.math.Ordering.Boolean.OrderingOps
scala.math.Ordering.Byte.OrderingOps
scala.math.Ordering.Char.OrderingOps
scala.math.Ordering.Short.OrderingOps
scala.math.Ordering.Int.OrderingOps
scala.math.Ordering.Long.OrderingOps
scala.math.Ordering.Float.TotalOrdering.OrderingOps
scala.math.Ordering.Float.IeeeOrdering.OrderingOps
scala.math.Ordering.DeprecatedFloatOrdering.OrderingOps
scala.math.Ordering.Double.TotalOrdering.OrderingOps
scala.math.Ordering.Double.IeeeOrdering.OrderingOps
scala.math.Ordering.DeprecatedDoubleOrdering.OrderingOps
scala.math.Ordering.BigInt.OrderingOps
scala.math.Ordering.BigDecimal.OrderingOps
scala.math.Ordering.String.OrderingOps
scala.math.Ordering.Symbol.OrderingOps
scala.math.Numeric[T].NumericOps
scala.math.Numeric.BigIntIsIntegral.OrderingOps
scala.math.Numeric.BigIntIsIntegral.IntegralOps
scala.math.Numeric.IntIsIntegral.OrderingOps
scala.math.Numeric.IntIsIntegral.IntegralOps
scala.math.Numeric.ShortIsIntegral.OrderingOps
scala.math.Numeric.ShortIsIntegral.IntegralOps
scala.math.Numeric.ByteIsIntegral.OrderingOps
scala.math.Numeric.ByteIsIntegral.IntegralOps
scala.math.Numeric.CharIsIntegral.OrderingOps
scala.math.Numeric.CharIsIntegral.IntegralOps
scala.math.Numeric.LongIsIntegral.OrderingOps
scala.math.Numeric.LongIsIntegral.IntegralOps
scala.math.Numeric.FloatIsFractional.OrderingOps
scala.math.Numeric.FloatIsFractional.FractionalOps
scala.math.Numeric.DoubleIsFractional.OrderingOps
scala.math.Numeric.DoubleIsFractional.FractionalOps
scala.math.Numeric.BigDecimalIsFractional.OrderingOps
scala.math.Numeric.BigDecimalIsFractional.FractionalOps
scala.math.Numeric.BigDecimalAsIfIntegral.OrderingOps
scala.math.Numeric.BigDecimalAsIfIntegral.IntegralOps
scala.math.Equiv[scala.Tuple9[T1, T2, T3, T4, T5, T6, T7, T8, T9]]
scala.math.Equiv[scala.Option[T]]
scala.math.Equiv[scala.Tuple6[T1, T2, T3, T4, T5, T6]]
scala.math.Equiv[scala.Tuple8[T1, T2, T3, T4, T5, T6, T7, T8]]
scala.math.Equiv[scala.Tuple2[T1, T2]]
scala.math.Equiv[scala.Tuple3[T1, T2, T3]]
scala.math.Equiv[scala.Tuple5[T1, T2, T3, T4, T5]]
scala.math.Equiv[scala.Tuple4[T1, T2, T3, T4]]
scala.math.Equiv[scala.Tuple7[T1, T2, T3, T4, T5, T6, T7]]
scala.math.Equiv[CC[T]]
scala.math.Equiv[CC[T]]
scala.math.BigInt
scala.math.BigInt
scala.math.BigInt
scala.math.Fractional[T].FractionalOps
scala.math.BigDecimal
scala.math.BigDecimal
scala.math.BigDecimal
scala.math.BigDecimal
scala.math.BigDecimal.RoundingMode.ValueOrdering.OrderingOps
scala.math.Ordered[T]
[error] -- [E007] Type Mismatch Error: C:\IdeaProjects\dtest\src\test\scala\Test1.scala:11:15
[error] 11 |  val b1 = bar(1)
[error]    |               ^
[error]    |               Found:    (1 : Int)
[error]    |               Required: Bla[Test1.this.Bar[T]]
[error]    |
[error]    |               where:    T is a type variable
[error] one error found
[error] one error found

Expectation

After the error I think the conversion should give up, but even if not, it shouldn't go through all these weird retries. At most it should attempt to widen the value. This only happens if the inline is transparent.

@soronpo soronpo changed the title transparent inline implicit def is called again and again transparent inline implicit conversion def is called again and again May 10, 2021
@nicolasstucki
Copy link
Contributor

We probably do exactly the same queries for

trait Bla[Of]:
  val value : Of
type X
object Bla :
  import scala.quoted.*
  implicit def conv[Of, From](from : From)(using X): Bla[Of] =
   ???

the difference is that we cannot observe them as users.

@soronpo
Copy link
Contributor Author

soronpo commented May 10, 2021

We probably do exactly the same queries for

trait Bla[Of]:
  val value : Of
type X
object Bla :
  import scala.quoted.*
  implicit def conv[Of, From](from : From)(using X): Bla[Of] =
   ???

the difference is that we cannot observe them as users.

No, it only happens with transparent. If you remove the transparent and just leave it as inline implicit def, it fails as expected without all the weird reentries.

@smarter
Copy link
Member

smarter commented May 10, 2021

The transparent macro gets executed only once if the compiler is run with -Ximport-suggestion-timeout 0, what's happening is that the import suggestion mechanism is running through all the implicit conversions on the classpath trying to find one that fits to then display in the error message. I don't know what happens exactly then but my guess is that when that fails because the implicit conversion is inapplicable, it tries to heal it by finding another implicit conversion, finds conv and because it's transparent ends up executing it at that point.

So I think the import suggestion mechanism needs to be more careful to avoid chaining implicit conversions (or even not suggest implicit conversions at all since they're such a big source of issues), but in general if your macro is transparent, you can't control how many times it's going to be executed by the compiler since the typechecker will sometimes backtrack and by definition we need to execute the macro to get its result type.

@soronpo
Copy link
Contributor Author

soronpo commented May 10, 2021

I think chaining is OK, as long as the conversion gets wider and wider and as a result, it is OK that there will be macro renentries. But the current search is completely irrelevant.

@smarter
Copy link
Member

smarter commented May 10, 2021

Scala has never supported chaining implicit conversions.

@Kordyjan Kordyjan added this to the 3.0.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants