[info] Benchmark Mode Cnt Score Error Units
[info] Main.hasTypeVariable thrpt 10 0.051 ± 0.002 ops/s
[info] Main.lowLevelReflection thrpt 10 0.361 ± 0.010 ops/s
[info] Main.noTypeVariable thrpt 10 0.223 ± 0.004 ops/s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TaskKey[Seq[String]]("allMainClassNames") := Def.taskDyn { | |
buildStructure.value.units | |
.apply(Keys.thisProjectRef.value.build) | |
.defined | |
.values | |
.toList | |
.map { p => | |
LocalProject(p.id) / Compile / discoveredMainClasses | |
} | |
.join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example | |
import scodec.bits.* | |
import scodec.codecs.* | |
object Main { | |
val iterations = 1000000000 | |
val str = "Hello World!" |
- 6.543094 Null
- 5.654039 MapUnit
- 4.128198 SeqApply
- 1.990676 StringPlusAny
- 1.58011 AutoUnboxing
- 1.447845 IterableOps
- 1.424732 PlatformDefault
- 1.257947 Equals
- 1.251545 Overloading
- 0.813279 RedundantIsInstanceOf
- ImplicitParameter 1.065469
- Overloading 0.510683
- Null 0.334346
- AutoUnboxing 0.280608
- ListAppend 0.24645
- IterableOps 0.130154
- SortFilter 0.107256
- Recursion 0.102776
- Any 0.100167
- AsInstanceOf 0.060164

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fix | |
import scala.meta.Defn | |
import scala.meta.Term | |
import scala.meta.transversers.* | |
import scalafix.Patch | |
import scalafix.lint.Diagnostic | |
import scalafix.lint.LintSeverity | |
import scalafix.v1.SyntacticDocument | |
import scalafix.v1.SyntacticRule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ScalaRunTimeForScalaJS { | |
def main(a: Array[String]): Unit = { | |
println(replStringOf((1 to 200).toList, 10)) | |
} | |
def replStringOf(arg: Any, maxElements: Int): String = | |
stringOf(arg, maxElements) match { | |
case null => "null toString" | |
case s if s.indexOf('\n') >= 0 => "\n" + s + "\n" | |
case s => s + "\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.wartremover.WartTraverser | |
import org.wartremover.WartUniverse | |
object StringTailInit extends WartTraverser { | |
def apply(u: WartUniverse): u.Traverser = | |
new u.Traverser(this) { | |
import q.reflect.* | |
override def traverseTree(tree: Tree)(owner: Symbol): Unit = { | |
tree match { | |
case Select(Apply(Ident("augmentString"), _ :: Nil), "init" | "tail") => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example | |
import scala.compiletime.testing.typeCheckErrors | |
object Main { | |
val x1: PosInt = 2 | |
def main(args: Array[String]): Unit = { | |
println(x1) |
NewerOlder