Skip to content

Instantly share code, notes, and snippets.

View lrytz's full-sized avatar
🦉

Lukas Rytz lrytz

🦉
View GitHub Profile
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases
#Warn ; Enable warnings to assist with detecting common errors
#UseHook ; Maybe more efficient? Prevents hotkey X to fire on Send {X}
SendMode Input ; Recommended for new scripts due to its superior speed and reliability
; Notes
; X::Y forwards modifiers, X::Send {Y} doesn't
; todo: alt emacs
diff --git a/ModuleSerializationProxy.class.asm b/ModuleSerializationProxy.class.asm
index ded4eb8..abdbadf 100644
--- a/ModuleSerializationProxy.class.asm
+++ b/ModuleSerializationProxy.class.asm
@@ -2,13 +2,6 @@
// access flags 0x31
public final class scala/runtime/ModuleSerializationProxy implements java/io/Serializable {
- // access flags 0x8
- static INNERCLASS scala/runtime/ModuleSerializationProxy$1 null null
--- unchecked-base.txt 2021-07-12 10:34:54.000000000 +0200
+++ unchecked-pr.txt 2021-07-12 10:34:26.000000000 +0200
@@ -1,9 +1,267 @@
+[akka-http] [warn] /akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala:269:18: abstract type Output in type pattern scala.collection.mutable.ListBuffer[Output] is unchecked since it is eliminated by erasure
+[akka-http] [warn] /akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala:269:18: abstract type Output in type pattern scala.collection.mutable.ListBuffer[Output] is unchecked since it is eliminated by erasure
+[akka-http] [warn] /akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala:269:18: abstract type Output in type pattern scala.collection.mutable.ListBuffer[Output] is unchecked since it is eliminated by erasure
+[akka-http] [warn] /akka-http-core/src/main/scala/akka/http/impl/engine/parsing/HttpMessageParser.scala:89:20: abstract type Output in type pattern scala.collection.m
object Scala2 {
type Service[K <: Common.AbstractServiceKey[_]] = K#Protocol // error in 3: "K is not a legal path since it is not a concrete type"
}
// object Scala3 {
// type Service[K <: Common.AbstractServiceKey[_]] = K match {
// case Common.AbstractServiceKey[t] => t
// }
// }
trait ActorRef[-T] {
  def !(msg: T): Unit = ()
}

class Behavior[T]

object Behaviors {
  def receive[T](onMessage: T => Behavior[T]): Behavior[T] = ???
 def same[T]: Behavior[T] = ???
@lrytz
lrytz / fetchpr
Created March 11, 2021 08:22
fetchpr
#!/bin/bash
set -e
[[ $# == 1 ]] || {
echo "usage: $0 <pr-number>"
exit 1
}
pr=$1
object T {
import scala.util.matching._
object sessionNames {
// All values are configurable by passing e.g. -Dscala.repl.name.read=XXX
final def propOr(name: String): String = propOr(name, "$" + name)
final def propOr(name: String, default: String): String =
sys.props.getOrElse("scala.repl.name." + name, default)
// Prefixes used in repl machinery. Default to $line, $read, etc.
def line = propOr("line")
s12 -Ccom.google.guava:guava:30.1-jre
val ps = Set("scala.collection", "scala.collection.convert", "scala.collection.immutable", "scala.collection.mutable")
val cp = com.google.common.reflect.ClassPath.from(classOf[List[_]].getClassLoader)
import scala.collection.JavaConverters._
val topLevel = ps.flatMap(p => cp.getTopLevelClasses(p).asScala)
val all = topLevel.flatMap(c => {
@lrytz
lrytz / wconf.md
Last active November 24, 2020 16:32

Configuring and suppressing warnings in Scala

Scala 2.13.2 and 2.12.13 introduced the -Wconf compiler flag to globally configure reporting of warnings, and the @nowarn annotation to locally suppress them. Having more control over compiler warnings makes them a lot more valuable:

  • In projects where the build log shows a lot of of warnings that are mostly ignored, new helpful warnings can easily go undetected. The new functionality can be used to clean up the build log with manageable efforts and potentially enable fatal warning (-Werror in 2.13, -Xfatal-warnings in 2.12). This has happened for example in Scala compiler and standard library projects in the past few months.
  • Projects that already use fatal warnings get better utilities to work around corner cases where a warning cannot be avoided. This can allow further -Xlint checks to be enabled.

In this post we go through the mechanics of configuring warnigns and also look at the new @nowarn annotation.

Warnings from the Scala compil

@lrytz
lrytz / A.scala
Last active October 15, 2020 08:01
jsr45 scala
object A {
def main(args: Array[String]): Unit = {
val testVar = "hai"
val res = B.foo(testVar)
println(res)
}
}