Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

pull requests I sent to scala/scala (ny-scala 2019)

417 views

Published on

I will go over some pull requests that I sent to the upcoming Scala 2.13.x, and describe how to participate in open-source work happening in scala/scala or sbt/* on GitHub.

Published in: Technology

pull requests I sent to scala/scala (ny-scala 2019)

  1. 1. pull requests I sent to scala/scala eugene yokota (@eed3si9n) Lightbend
  2. 2. ecosystem
  3. 3. goal 1. become an active participant in the Scala ecosystem
  4. 4. contributions 1. help adoption 2. assist other users 3. report issues 4. garden the issue tracker 5. contribute to docs 6. expand ecosystem 7. patch the core
  5. 5. help adoption • help the adoption of Scala at work • help the adoption of Lightbend Platform Subscription at work
  6. 6. assist other users • assist other users at work, Stackoverflow, Gitter chat etc. • blog • give talks at a meetup :)
  7. 7. reporting issues
  8. 8. art of reporting issues • good bug reports are more likely to be fixed. • some bad bug reports can be irritating. • Joel Spolsky: Painless Bug Tracking
  9. 9. problem space solution space
  10. 10. problem space solution space • observations (sometimes with lower confidence) • requirements
  11. 11. problem space solution space • observations (sometimes with lower confidence) • requirements • many possible answers • design decisions
  12. 12. good bug report: 3 + 1 things • steps: steps to reproduce your problem. • problems. what you think is the problem. include full error message, stack trace, etc. • expectations. describe what you think should've happen. • (notes). your analysis of what's going on.
  13. 13. gardening the issue tracker
  14. 14. • summarize discussions from other channels • capture problems • organize observations, opinions, and analyses • reproduce reported issues • link to relevant source code • leave breadcrumbs for contributors (previous discussions, 
 language spec, precedence in other languages) • review pull requests • triage gardening the issue tracker
  15. 15. • scala/docs.scala-lang Scala documentation • scala/scala ScalaDocs for standard library, language spec • sbt/website sbt documentation • sbt/sbt ScalaDocs for sbt contribute docs
  16. 16. • Scala libraries, tooling, upgrade to 2.13.0-M* • sbt plugins, tooling, upgrade to sbt 1.x expand ecosystem
  17. 17. patching the core
  18. 18. • before 2018, I had sent 2 pull requests to scala/scala • in 2018, I sent 28 pull requests in my own time, starting with easy looking ones • by no means I am an expert #50
  19. 19. 1. engineering patch (zombie robot patch) • pick up an approved problem, and deliver solution. 2. activist patch (cowboy patch) • propose a problem and its solution. patching the core
  20. 20. • for (engineering) contribution ideas, go to scala/bug or sbt/sbt issue tracker • channel your inner core dev team scala/bug
  21. 21. • Gitter chat scala/contributors, sbt/sbt-contrib • discourse forum • contributors.scala-lang.org • Lightbend Discuss: Tooling • meeting SIP meeting, weekly sbt meeting • pull request communication channels
  22. 22. Document how to run tests #6369 • CONTRIBUTING.md#tests • JUnit (typically for library)
 > junit/testQuick • ScalaCheck 
 > scalacheck/testOnly ByOneRangeTest • Partest (integration testing)
 Pos (compiles), Neg (errors), Run (prints something)
 > partest --grep range
  23. 23. Deprecate scala.Predef.any2stringadd #6315 • in Scala 2.12 • Some(true) + "what" uses Predef.any2stringadd • "what" + Some(true) uses special String_+ method • #6315 deprecates the former, and removes it under 
 -Xsource:2.14 flag
  24. 24. Remove octal escape literals
 #6324 • in Scala 2.11, octal escape literal "10" was deprecated, and removed under -Xfuture #2342 • I grepped for -Xfuture usages and came across this one (gardening) • #6324 removes it • change is mostly contained in Scanner (converts stream of characters into tokens)
  25. 25. datatypes • trees data structure representing the source code • types type information, which holds on to members • symbols unique reference to entities like classes and methods
  26. 26. compiler phases • scalac -Xshow-phases • parser (parse source into ASTs) • namer (resolves names, attach symbols) • packageobjects (load package objects) • typer (type the trees) • patmat (translate match expressions) • blabla (superaccessors, extmethods, pickler) • refchecks (reference/override checking) • blabla (uncurry, fields, tailscalls, specialize, explicitouter, erasure, posterasure, lambdalift, constructors, flatten, mixin, cleanup, delambdafy) • jvm (generate JVM bytecode)
  27. 27. -Xprint:all • scalac -Xprint:all src/main/scala/Hello.scala [[syntax trees at end of typer]] // Hello.scala package <empty> { object Hello extends AnyRef with App { def <init>(): Hello.type = { Hello.super.<init>(); () }; "foo" match { case "bar" => scala.Predef.println("bar") case _ => scala.Predef.println("hello1") } } } [[syntax trees at end of patmat]] // Hello.scala package <empty> { object Hello extends AnyRef with App { def <init>(): Hello.type = { Hello.super.<init>(); () }; { case <synthetic> val x1: String = "foo"; case5(){ if ("bar".==(x1)) matchEnd4(scala.Predef.println("bar")) else case6() }; case6(){ matchEnd4(scala.Predef.println("hello1")) };
  28. 28. Deprecate procedure syntax without -Xfuture
 #6325 • in Scala 2.11, procedure syntax was deprecated under -Xfuture #3076 • #6325 deprecates it without -Xfuture, and removes it under -Xsource:2.14 • actual change is in Parser, but 932 files were changed because code in test, library, compiler were updated using Scalafix
  29. 29. Remove val in for comprehension under -Xsource:14
 #6348 • in Scala 2.10, val inside for comprehension was deprecated
 for {
 x <- 1 to 5
 val y = x
 } yield x+y • #6348 removes it under -Xsource:2.14 • change contained in Parser
  30. 30. Fix error message for overriding type alias
 #6350 • Fixes scala/bug#6001 "Confusing first error message that overriding type members is possible", which was marked help wanted • #6350 implements error message suggested by DaveScala in #6001:
 overriding concrete type alias type A1 is not allowed except when equivalent • change contained in RefChecks
  31. 31. Scala Language Spec clarification on extractor and null def nullMatch[A](xs: Array[A]): Boolean = xs match {
 case Array(xs @_*) => false
 case _ => true
 } 
 nullMatch(null)
  32. 32. Scala Language Spec clarification on extractor and null • def nullMatch[A](xs: Array[A]): Boolean = xs match {
 case Array(xs @_*) => false
 case _ => true
 }
 nullMatch(null) • in Scala 2.12, pattern matcher would pass null into Array's unapplySeq. scala/bug#4364 asks to clarify SLS. • I sent two competing pull requests to solve this two ways: 1. status quo: just change SLS and let each extractors handle null #6374 2. progressive: change SLS, change pattern matcher to automatically treat null as no match #6485
  33. 33. Remove Float range and Double range
 #6468 • in Scala 2.12 there are number of issues reported around Double ranges, like scala/bug#8518
 
 scala> (1.0 to 2.0 by 0.1).take(3).toList
 res0: List[Double] = List(1.0, 1.1)
 
 scala> (1.0 to 2.0 by 0.1).take(4).toList
 res1: List[Double] = List(1.0, 1.1, 1.2000000000000002, 1.3000000000000003) • initially I attempted to fix this by using BigDecimal internally, but was convinced by Rex Kerr it's a bad idea scala/collection- strawman#489 • #6468 removes them from the standard library.
  34. 34. Deprecate view bounds without -Xfuture
 #6500 • in Scala 2.11, view bounds was deprecated under - Xfuture #2909 • #6500 deprecates it without -Xfuture, and removes it under -Xsource:2.14 • change contained in Parser
  35. 35. Suggest typo corrections for "not a member"
 #6711 • fixes scala/bug#10181, labelled help wanted • in Scala 2.10.0-M1, Paul Phillips implemented 
 -Ysuggest-idents, which suggested possible identifiers but it was removed in M2 citing possible performance impact • #6711 implements the suggestions only for "not a member" error
 
 example.scala:20: error: object stdin is not a member of package io
 did you mean StdIn?
 import scala.io.stdin.{readLine => line}
 ^

  36. 36. Add tap and pipe methods to Any under import
 #7007 • fixes scala/bug#5324, labelled help wanted • import scala.util.chaining._
 val xs = List(1, 2, 3)
 .tap(ys => println("debug " + ys.toString))
 
 val times6 = (_: Int) * 6
 (1 - 2 - 3)
 .pipe(times6) • I initially sent #6767, made it into a macro based on a review, which then was rejected by other reviews

  37. 37. Emit bridge method forwarders with BRIDGE flag
 #7035 • attempted to fix scala/bug#11061 "JDK 11 gets confused about override methods: reference to X is ambiguous" in Scala 2.12.7
 
 trait A { def f: Object }
 object B extends A { def f: String = "b" }
 • #7035 initially backported 2.13 behavior and didn't emit forwarder in mirror class for bridge methods, but was suggested to emit ACC_BRIDGE flag • Scala 2.12.7 ended up creating more problems, so eventually 2.13 change was backported for 2.12.8 in #7469
  38. 38. Apache License Version 2.0
 #7306 • #7306 changes the license to Apache v2 • applies header using sbt-header
  39. 39. reference
  40. 40. other talks • Seth Tisue, You Are A Scala Contributor
 (video, pdf) • Chris Birchall, A Deep Dive into Scalac (video, slides) • Jason Zaugg, Scalac Survival Guide (video)
  41. 41. • ny-scala member since 2010 • Lightbend Tooling team since 2014 • Scala contributions were done in my own

×