Skip to content

Instantly share code, notes, and snippets.

View DarkDimius's full-sized avatar

Dmitry Petrashko DarkDimius

View GitHub Profile
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

Keybase proof

I hereby claim:

  • I am DarkDimius on github.
  • I am darkdimius (https://keybase.io/darkdimius) on keybase.
  • I have a public key whose fingerprint is D52F 52CB D17F D6EF EB47 672E 4D4B FF78 772D 136D

To claim this, I am signing this object:

$ 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 \
$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.
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
@DarkDimius
DarkDimius / 1.Inheritance.scala
Last active April 19, 2017 08:53
Reachability examples
trait A {/* has a `def toString: String` inherited from scala.Any */}
class B extends A { override def toString = "B"}
class C extends A { override def toString = "C" /* is this dead code? */ }
def main(a: Array[String]): Unit = {
def foo(a: A) = a.toString // does it call .toString on all the A’s?
val b: B = new B;
val c: C = new C;
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
}
meta:
id: tasty
file-extension: tasty
endian: be
seq:
- id: magic
contents: [0x5C, 0xA1, 0xAB, 0x1F]
- id: major_version
type: Nat
- id: minor_version
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)
object unsoundForwardRef {
trait LowerBound[T] {
type M >: T;
}
trait UpperBound[U] {
type M <: U;
}
val bounded1 : LowerBound[Int] with UpperBound[String] = hideForwardRef