Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitry Petrashko DarkDimius

View GitHub Profile
View -p ast
class <emptyTree><<C <root>>> < ()
a = "part 1 of heredoc ".concat("not a heredoc".+("eom part\n").to_s()).concat("\n").concat("eom part\n").concat("EOM\n").concat("part 2 of heredoc\n").to_s()
b = "oweqijfoiwjefqwoefij\n"
def foo<<C <todo sym>>>(&<blk>)
begin
c = "oqweijfoqwiejf\n"
<self>.puts(c)
end
View gist:584d7af6c5c51c573b175bb7bcbc4362
$ native-image -cp /usr/local/Cellar/scala/2.12.2/libexec/lib/jline-2.14.3.jar:/usr/local/Cellar/scala/2.12.2/libexec/lib/scala-compiler.jar:/usr/local/Cellar/scala/2.12.2/libexec/lib/scala-library.jar:/usr/local/Cellar/scala/2.12.2/libexec/lib/scala-parser-combinators_2.12-1.0.5.jar:/usr/local/Cellar/scala/2.12.2/libexec/lib/scala-reflect.jar:/usr/local/Cellar/scala/2.12.2/libexec/lib/scala-swing_2.12-2.0.0.jar:/usr/local/Cellar/scala/2.12.2/libexec/lib/scala-xml_2.12-1.0.6.jar:/usr/local/Cellar/scala/2.12.2/libexec/lib/scalap-2.12.2.jar scala.tools.nsc.Main -verbose
Executing [
/Users/dark/Downloads/graalvm-0.26-macosx-amd64-jdk8/graalvm-0.26/jre/bin/java \
-server \
-XX:+UnlockExperimentalVMOptions \
-XX:+EnableJVMCI \
-XX:-UseJVMCIClassLoader \
-XX:-UseJVMCICompiler \
-d64 \
-noverify \
View gist:7658a35cf31333533e35432f15bc5642
$native-image -cp /Users/dark/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.11.jar:/Users/dark/workspace/dotty/bin/../library/target/scala-2.11/dotty-library_2.11-0.3.0-bin-SNAPSHOT-nonbootstrapped.jar:/Users/dark/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-2.jar:/Users/dark/.ivy2/cache/org.scala-sbt/interface/jars/interface-0.13.15.jar:/Users/dark/workspace/dotty/bin/../interfaces/target/dotty-interfaces-0.3.0-bin-SNAPSHOT.jar:/Users/dark/workspace/dotty/bin/../compiler/target/scala-2.11/dotty-compiler_2.11-0.3.0-bin-SNAPSHOT-nonbootstrapped.jar:/Users/dark/workspace/dotty/bin/../library/target/scala-2.11/dotty-library_2.11-0.3.0-bin-SNAPSHOT-nonbootstrapped.jar -classpath /Users/dark/workspace/dotty/bin/../interfaces/target/dotty-interfaces-0.3.0-bin-SNAPSHOT.jar:/Users/dark/workspace/dotty/bin/../compiler/target/scala-2.11/dotty-compiler_2.11-0.3.0-bin-SNAPSHOT-nonbootstrapped.jar:/Users/dark/workspace/dotty/bin/../library/target/scala-2.11/dotty-library_2.
View hello-world stats
Class allocations by phase:
Flatten
dotty.tools.dotc.core.Contexts$InitialContext -> 36
FirstTransform
dotty.tools.dotc.ast.Trees$Template -> 2
dotty.tools.dotc.ast.Trees$Apply -> 1
dotty.tools.dotc.ast.Trees$TypeDef -> 2
dotty.tools.dotc.core.Contexts$InitialContext -> 34
dotty.tools.dotc.ast.Trees$ValDef -> 4
View foo.scala
object test {
final val s = false
if (s) { println("a")} // <-- will not be emmited in bytecode
final val s1: Boolean = false
if (s1) { println("b")} // <-- will be emmited in bytecode
}
View tasty.ksy
meta:
id: tasty
file-extension: tasty
endian: be
seq:
- id: magic
contents: [0x5C, 0xA1, 0xAB, 0x1F]
- id: major_version
type: Nat
- id: minor_version
View gist:1dd60e2b795260e3ed0823f26e155685
Exception in thread "main" java.lang.AssertionError: assertion failed: module HashSet
at scala.Predef$.assert(Predef.scala:165)
at dotty.tools.dotc.core.tasty.TreePickler.pickleDef(TreePickler.scala:319)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:470)
at dotty.tools.dotc.core.tasty.TreePickler$$anonfun$pickleTree$15$$anonfun$apply$mcV$sp$9.apply(TreePickler.scala:450)
at dotty.tools.dotc.core.tasty.TreePickler$$anonfun$pickleTree$15$$anonfun$apply$mcV$sp$9.apply(TreePickler.scala:450)
at scala.collection.immutable.List.foreach(List.scala:381)
at dotty.tools.dotc.core.tasty.TreePickler$$anonfun$pickleTree$15.apply$mcV$sp(TreePickler.scala:450)
at dotty.tools.dotc.core.tasty.TreePickler.dotty$tools$dotc$core$tasty$TreePickler$$withLength(TreePickler.scala:29)
at dotty.tools.dotc.core.tasty.TreePickler.pickleTree(TreePickler.scala:450)
View unsoundForward.scala
object unsoundForwardRef {
trait LowerBound[T] {
type M >: T;
}
trait UpperBound[U] {
type M <: U;
}
val bounded1 : LowerBound[Int] with UpperBound[String] = hideForwardRef
View Dotty-dotty
dark@tsf-452-wpa-3-234 ~/workspace/dotty/src/dotty/tools/dotc (opto) $ timed-bootstrap-bench-classes
typer/RefChecks.scala:68: warning: match may not be exhaustive.
It would fail on the following input: (_, _)
for ((_, m1 :: m2 :: _) <- (clazz.info member nme.applyDynamic).alternatives groupBy (_.symbol.typeParams.length)) {
^
one warning found
there were 4 deprecation warning(s); re-run with -deprecation for details
time elapsed: 29438ms
one warning found
there were 4 deprecation warning(s); re-run with -deprecation for details
View 0.NewSource.scala
case class CC(a: Int, b: Object)
object Lists{
def foo(x: Any): Int = {
val (a, b) = x match {
case CC(s @ 1, CC(t, _)) =>
(s , 2)
case _ => (42, 43)
}
a + b
}
You can’t perform that action at this time.