Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
xuwei-k / InliningProfile.scala
Last active August 29, 2022 14:25
Scala 3 inlining phase profile compiler plugin
package example
import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.core.Contexts.Context
import dotty.tools.dotc.core.Phases.Phase
import dotty.tools.dotc.plugins.ResearchPlugin
import dotty.tools.dotc.transform.Inlining
class InliningProfile extends ResearchPlugin {
override val name: String = "my-inlining"
package example
import org.wartremover.LogLevel
import org.wartremover.WartTraverser
import org.wartremover.WartUniverse
import scala.quoted.Quotes
import scala.tasty.inspector.Inspector
import scala.tasty.inspector.Tasty
import scala.tasty.inspector.TastyInspector
@xuwei-k
xuwei-k / gist:52838ed0546cedf9dc1a1ae3d13816a5
Created March 26, 2022 08:38
wartremover SizeIs scala3-compiler.jar 3.1.3-RC1-bin-20220325-6f3fe05-NIGHTLY
[error] -- Warning: library/src/scala/runtime/stdLibPatches/Predef.scala:7:8 -----------
[error] [wartremover:SizeIs] Maybe you can use `sizeIs` instead of `size`
[error] -- Warning: library/src/scala/runtime/stdLibPatches/Predef.scala:10:8 ----------
[error] [wartremover:SizeIs] Maybe you can use `sizeIs` instead of `size`
[error] -- Warning: compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala:328:46 ---
[error] [wartremover:SizeIs] Maybe you can use `sizeIs` instead of `size`
[error] -- Warning: out/bootstrap/scala3-compiler-bootstrapped/scala-3.1.3-RC1-bin-20220325-6f3fe05-NIGHTLY-nonbootstrapped/src_managed/main/scalajs-ir-src/org/scalajs/ir/Trees.scala:454:32
[error] [wartremover:SizeIs] Maybe you can use `sizeIs` instead of `size`
[error] -- Warning: compiler/src/dotty/tools/MainGenericRunner.scala:114:42 ------------
[error] [wartremover:SizeIs] Maybe you can use `sizeIs` instead of `size`
import scala.compiletime.ops.string.{+, Substring, Length}
import scala.compiletime.ops.int.{<, >}
import scala.compiletime.ops.int
sealed trait HList {
def ::[T](t: T): T :: this.type = new ::(t, this)
}
final case class ::[H, +T <: HList](h: H, t: T) extends HList
sealed trait HNil extends HList
import sbtprojectgraph._
import scala.sys.process.Process
import scala.collection.JavaConverters.*
lazy val a0 = project
.dependsOn(
a7,
a1
)
import scala.compiletime.ops.string.{+, Substring, Length}
import scala.compiletime.ops.int
sealed trait HList {
def :+:[T](t: T): T :+: this.type = new :+:(t, this)
}
final case class :+:[H, +T <: HList](h: H, t: T) extends HList
sealed trait HNil extends HList
case object HNil extends HNil
import scala.compiletime.ops.string.{+, Substring, Length}
import scala.compiletime.ops.int
sealed trait HList
sealed trait :+:[H, +T <: HList] extends HList
sealed trait HNil extends HList
sealed trait Token
sealed trait NumLiteral[A <: Int] extends Token
sealed trait Add extends Token
package fix
import scalafix.Patch
import scalafix.v1.SyntacticDocument
import scalafix.v1.SyntacticRule
import scala.meta.Term
import scala.meta.Type
class MockitoPureEff extends SyntacticRule("MockitoPureEff") {
override def fix(implicit doc: SyntacticDocument): Patch = {
[error] /Users/kenji/lampepfl/dotty/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala:938: error: error in interpolated string: identifier, `this' or block expected
[error] debug.println(i"checking redundancy in $_match")
[error] ^
[error] at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:16)
[error] at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:16)
[error] at scala.meta.internal.parsers.Reporter$$anon$1.syntaxError(Reporter.scala:22)
[error] at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:17)
[error] at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:17)
[error] at scala.meta.internal.parsers.Reporter$$anon$1.syntaxError(Reporter.scala:22)
[error] at scala.meta.internal.parsers.ScalametaParser.unquoteExpr(ScalametaParser.scala:2316)
scala.meta.Name$Anonymous
scala.meta.Name$Indeterminate
scala.meta.Lit$Null
scala.meta.Lit$Int
scala.meta.Lit$Double
scala.meta.Lit$Float
scala.meta.Lit$Byte
scala.meta.Lit$Short
scala.meta.Lit$Char
scala.meta.Lit$Long