Skip to content

Instantly share code, notes, and snippets.

java.lang.AssertionError: assertion failed: invalid prefix ExprType(AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class ValueOf),List(TypeRef(NoPrefix,type L))))
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
at dotty.tools.dotc.core.Types$NamedType.<init>(Types.scala:2186)
at dotty.tools.dotc.core.Types$TypeRef.<init>(Types.scala:2799)
at dotty.tools.dotc.core.Types$CachedTypeRef.<init>(Types.scala:2855)
at dotty.tools.dotc.core.Uniques$NamedTypeUniques.newType$1(Uniques.scala:45)
at dotty.tools.dotc.core.Uniques$NamedTypeUniques.linkedListLoop$1(Uniques.scala:56)
at dotty.tools.dotc.core.Uniques$NamedTypeUniques.enterIfNew(Uniques.scala:62)
at dotty.tools.dotc.core.Types$TypeRef$.apply(Types.scala:2914)
at dotty.tools.dotc.core.Types$TypeRef$.apply(Types.scala:2920)
"pool-11-thread-7" #160 prio=5 os_prio=31 cpu=70645.61ms elapsed=146.72s tid=0x0000000131d56800 nid=0x14303 runnable [0x00000002b5737000]
java.lang.Thread.State: RUNNABLE
at dotty.tools.dotc.core.Types$VariantTraversal.stopBecauseStaticOrLocal(Types.scala:5532)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5649)
at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:266)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5655)
at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:266)
at dotty.tools.dotc.core.Types$TypeMap.op$proxy17$1(Types.scala:5618)
at dotty.tools.dotc.core.Types$TypeMap.mapArgs(Types.scala:5618)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5655)
@mrdziuban
mrdziuban / error.txt
Created March 27, 2019 15:58
object scala in compiler mirror not found
[error] error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
[error] ## Exception when compiling 5 sources to /my/thing/target/scala-2.12/classes
[error] object scala in compiler mirror not found.
[error] scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:24)
[error] scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:25)
[error] scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$4(Mirrors.scala:61)
[error] scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:61)
[error] scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:73)
[error] scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:179)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:196)
@mrdziuban
mrdziuban / CsvDerivationMagnolia.scala
Created May 18, 2018 15:51
CSV type class derivation using magnolia
import magnolia.{CaseClass, Magnolia, SealedTrait}
import scala.language.experimental.macros
trait Csv[A] { def apply(a: A): Seq[String] }
trait LPCsv {
type Typeclass[A] = Csv[A]
def combine[A](ctx: CaseClass[Csv, A]): Csv[A] =
a => ctx.parameters.foldLeft(List[String]())((acc, p) => acc ++ p.typeclass(p.dereference(a)))
@mrdziuban
mrdziuban / CsvDerivation.scala
Last active May 23, 2018 12:02
Incorrect behavior with type class derivation macro
import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
trait Csv[A] { def apply(a: A): Seq[String] }
object Csv {
implicit def deriveCsv[A]: Csv[A] = macro CsvMacro.csvImpl[A]
implicit val csvStr: Csv[String] = new Csv[String] { def apply(s: String) = Seq(s) }
implicit def csvSeq[A](implicit ca: Csv[A]): Csv[Seq[A]] = new Csv[Seq[A]] {
def apply(a: Seq[A]) = a.flatMap(ca(_))
@mrdziuban
mrdziuban / FoldLeft.scala
Last active January 3, 2018 23:50
Simple shapeless foldLeft
import shapeless.{::, HList, HNil, Poly2}
import shapeless.ops.hlist.Prepend
import shapeless.record._
import shapeless.syntax.singleton._
val h = 1 :: "foo" :: true :: HNil
object withoutAnnotation extends Poly2 {
implicit def id[Acc <: HList, A, Res <: HList](
implicit pp: Prepend.Aux[Acc, A :: HNil, Res]) =
@mrdziuban
mrdziuban / TestTypify.scala
Last active January 3, 2018 15:35
shapeless implicit LeftFolder resolution
import $ivy.`com.chuusai::shapeless:2.3.3`
// import $ivy.`com.chuusai::shapeless:2.3.4-SNAPSHOT`
import $ivy.`org.scalaz::scalaz-core:7.2.17`
interp.repositories() ++= Seq(coursier.MavenRepository("https://dl.bintray.com/bondlink/Typify"))
import $ivy.`typify::typify:2.4.1`
import shapeless.{::, HNil}
import shapeless.syntax.singleton._
@mrdziuban
mrdziuban / first_start.log
Created December 30, 2017 13:09
calibre-web logs
,----,
,/ .`|
,` .' : .--.--. ,----, ,-.
; ; // / '. .' .' \ ,--/ /|
.'___,/ ,'| : /`. / ,----,' |,--. :/ |
| : | ; | |--` | : . ;: : ' /
; |.'; ; | : ;_ ; |.' / | ' /
`----' | | \ \ `. `----'/ ; ' | :
' : ; `----. \ / ; / | | \
| | ' __ \ \ | ; / /-, ' : |. \
@mrdziuban
mrdziuban / scala_repl.rb
Last active March 6, 2018 07:18
Start a Scala REPL with the highest version of each jar in $HOME/.ivy2/cache on the classpath
#!/usr/bin/env ruby
################################################################################
# #
# Starts a Scala REPL with the highest version of each jar in #
# $HOME/.ivy2/cache on the classpath. #
# #
# See below for installation instructions #
# #
################################################################################
elixirscript ':console.log("test")' --elixir