bug icon indicating copy to clipboard operation
bug copied to clipboard

Compiler hangs on code involving type projections and upper and lower bounds

Open scabug opened this issue 8 years ago • 2 comments
trafficstars

The following hangs the compiler:

trait Data { self =>
  type Type >: self.type
}

trait Eq[Type <: Data, A <: Type, B <: Type] { ab =>
  final def lift[F[_ <: Type] <: Data]: Eq[Type, F[A], F[B]] =
    Eq.lift[A, B, F](ab)
}

object Eq {
  def lift[A <: Data, B <: A#Type, F[_ <: A#Type] <: Data](eq: Eq[A#Type, A, B]): Eq[A#Type, F[A], F[B]] = ???
}

It should be possible to minimize it further.

scabug avatar Mar 15 '17 02:03 scabug

Imported From: https://issues.scala-lang.org/browse/SI-10227?orig=1 Reporter: Alexander Konovalov (alexknvl) Affected Versions: 2.12.1

scabug avatar Mar 15 '17 02:03 scabug

still hangs 2.13.16:

   java.lang.Thread.State: RUNNABLE
	at scala.reflect.internal.Kinds$KindErrors.qualify(Kinds.scala:53)
	at scala.reflect.internal.Kinds$KindErrors.strictnessMessage(Kinds.scala:58)
	at scala.reflect.internal.Kinds$KindErrors.$anonfun$errorMessage$3(Kinds.scala:88)
	at scala.reflect.internal.Kinds$KindErrors$$Lambda$342/0x00000005012cbb58.apply(Unknown Source)
	at scala.Function2.$anonfun$tupled$1(Function2.scala:55)
	at scala.Function2$$Lambda$190/0x00000005011cf360.apply(Unknown Source)
	at scala.collection.immutable.List.map(List.scala:247)
	at scala.reflect.internal.Kinds$KindErrors.errorMessage(Kinds.scala:81)
	at scala.tools.nsc.typechecker.Infer$Inferencer.$anonfun$checkKindBounds$1(Infer.scala:980)

3.6.3 gives

% scala compile --server=false -S 3 S.scala
-- [E007] Type Mismatch Error: /Users/tisue/tmp/si-10227/S.scala:7:21 ----------
7 |    Eq.lift[A, B, F](ab)
  |                     ^^
  | Found:    (Eq.this : Eq[Type, A, B])
  | Required: Eq[A#Type², A, B]

SethTisue avatar Feb 10 '25 20:02 SethTisue