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 p | |
class Client { | |
def f = m.M.report("hello, world") | |
} |
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 specsy { | |
trait Expectable[A] | |
trait MatchResult[A] | |
trait Matcher[-T] { outer => | |
def apply[S <: T](t: Expectable[S]): MatchResult[S] | |
} | |
object Matchers { | |
def oneMatcher[S1]: Matcher[S1] = OneMatcher.asInstanceOf[Matcher[S1]] | |
def twoMatcher[S1, S2]: Matcher[(S1, S2)] = TwoMatcher.asInstanceOf[Matcher[(S1, S2)]] | |
} |
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
[info] Benchmark (corpusPath) (corpusVersion) (extraArgs) (resident) (scalaVersion) (source) Mode Cnt Score Error Units | |
[info] HotScalacBenchmark.compile ../corpus latest false 2.13.1 scalap sample 179 1888.480 ± 25.408 ms/op | |
[info] HotScalacBenchmark.compile:compile·p0.00 ../corpus latest false 2.13.1 scalap sample 1694.499 ms/op | |
[info] HotScalacBenchmark.compile:compile·p0.50 ../corpus latest false 2.13.1 scalap sample 1897.923 ms/op | |
[info] HotScalacBenchmark.compile:compile·p0.90 ../corpus latest false 2.13.1 scalap sample 1973.420 ms/op | |
[info] HotScalacBenchmark.compile:compile·p0.95 ../corpus latest false 2.13.1 scalap sample 2004.877 ms/o |
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
There is only one rule for how placeholder syntax is translated to an anonymous function: | |
The next enclosing Expr, as defined by the syntax summary, is the function body, with the underscores converted to parameters. | |
This definition is given in section 6.23.2 of the the spec. | |
An Expr includes any of the control constructs such as if, while, and try, as well as function literal syntax x => f(x). | |
Function args and tuples (things in parens) are a list of Exprs. |
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
Ref: https://contributors.scala-lang.org/t/proposed-syntax-for-root/1035 | |
Use package for _root_ | |
import _root_.a // now | |
import package.a // proposed (alternatively just leading dot) | |
Use underscore for symbol in scope | |
import a.b // now and forever, no special syntax |
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 scala.concurrent | |
import org.junit.Assert._ | |
import org.junit.Test | |
import org.junit.runner.RunWith | |
import org.junit.runners.JUnit4 | |
import scala.tools.testing.AssertUtil._ | |
import scala.util.Try |
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 object futurism { | |
import scala.language.higherKinds | |
import scala.collection.generic.CanBuildFrom | |
import scala.collection.{TraversableOnce => Once} | |
import scala.concurrent._ | |
import scala.util.{Try, Success, Failure} | |
import scala.util.control.NonFatal | |
// TraversableOnce.filter results in an iterator that !isTraversableAgain | |
implicit class NaiveSelectable(val co: Future.type) extends AnyVal { |