You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- [E008] MemberNotFoundError:Id.scala:23:32-------------------------------23|valres5= foo.map(_ +1).value.bar
|^^^^^^^^^^^^^^^^^^^^^^^^|value bar is not a member of Id[B], but could be made available as an extension method.
||One of the following imports might fix the problem:
||importInt.int2double|importInt.int2float|importInt.int2long|importmath.BigDecimal.int2bigDecimal|importmath.BigInt.int2bigInt|importmath.Numeric.IntIsIntegral.mkNumericOps|importmath.Numeric.BigIntIsIntegral.mkNumericOps|importmath.Numeric.IntIsIntegral.mkOrderingOps|importmath.Ordering.Int.mkOrderingOps|importLong.long2double|importLong.long2float|importmath.BigDecimal.long2bigDecimal|importmath.BigInt.long2bigInt|importmath.Numeric.LongIsIntegral.mkNumericOps|importmath.Numeric.FloatIsFractional.mkNumericOps|importmath.Ordering.Long.mkOrderingOps|importFloat.float2double|importmath.BigDecimal.double2bigDecimal|importmath.Numeric.DoubleIsFractional.mkNumericOps|importmath.Numeric.BigDecimalAsIfIntegral.mkNumericOps|importmath.Numeric.BigDecimalIsFractional.mkNumericOps|importmath.Numeric.LongIsIntegral.mkOrderingOps|importmath.Numeric.BigDecimalAsIfIntegral.mkOrderingOps|importmath.Numeric.BigDecimalIsFractional.mkOrderingOps|importmath.Numeric.BigIntIsIntegral.mkOrderingOps|importmath.Numeric.FloatIsFractional.mkOrderingOps|importmath.Numeric.DoubleIsFractional.mkOrderingOps|importmath.Ordering.BigDecimal.mkOrderingOps|importmath.Ordering.BigInt.mkOrderingOps|importmath.Ordering.DeprecatedFloatOrdering.mkOrderingOps|importmath.Ordering.Float.IeeeOrdering.mkOrderingOps|importmath.Ordering.Float.TotalOrdering.mkOrderingOps|importmath.Ordering.DeprecatedDoubleOrdering.mkOrderingOps|importmath.Ordering.Double.IeeeOrdering.mkOrderingOps|importmath.Ordering.Double.TotalOrdering.mkOrderingOps|importmath.Integral.Implicits.infixIntegralOps|importmath.Numeric.Implicits.infixNumericOps|importmath.Ordered.orderingToOrdered|importmath.Ordering.Implicits.infixOrderingOps|importreflect.Selectable.reflectiveSelectable|importimplicits.Not.amb1|importimplicits.Not.amb2|||where: B is a typevariablewith constraint >:Int1 error found
expectation
This compiles on Scala 2. I'm running into this in the Cats tests, where we use ScalaTest's should matchers to tests methods on e.g. WriterT[Id, A, B], which return Id[C] where C is inferred.
If you change Id to something like type Id[A] = List[A] and edit Foo appropriately, it compiles fine on Dotty.
The text was updated successfully, but these errors were encountered:
It also compiles if Id is covariant. I.e. if I change it like this
type Id[+A] = A
it compiles OK. What happens here is that A is not instantiated since it is nonvariant in the type of foo.map(_ + 1).value. Then since A only has a lower bound no member can be found on A.
A possible fix is to see "through" the alias to realize that A is covariant after all and should be minimized. That might also be a fix for #7993.
minimized code
Compilation output
expectation
This compiles on Scala 2. I'm running into this in the Cats tests, where we use ScalaTest's
should
matchers to tests methods on e.g.WriterT[Id, A, B]
, which returnId[C]
whereC
is inferred.If you change
Id
to something liketype Id[A] = List[A]
and editFoo
appropriately, it compiles fine on Dotty.The text was updated successfully, but these errors were encountered: