Skip to content

Commit

Permalink
Change version; make wrong patterns error instead of crashing scalac
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-py committed Sep 9, 2018
1 parent 1bd7dda commit 2efd18f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "better-monadic-for"
organization := "com.olegpy"
version := "0.2.4"
version := "0.3.0-M1"
licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
homepage := Some(url("http://github.com/oleg-py/better-monadic-for"))

Expand Down
10 changes: 7 additions & 3 deletions src/main/scala/com/olegpy/bm4/ImplicitPatterns.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait ImplicitPatterns extends TreeUtils { self =>
object ImplicitPatternDefinition {
lazy val ut = new NoTupleBinding {
val noTupling: Boolean = false
lazy val global = self.global
lazy val global: self.global.type = self.global
}

def embedImplicitDefs(tupler: Tree, defns: List[ValDef]): Tree = {
Expand Down Expand Up @@ -81,8 +81,12 @@ trait ImplicitPatterns extends TreeUtils { self =>
def unapply(arg: Tree): Option[TermName] = arg match {
// TODO: support implicit0(x: Type)
case q"implicit0(${t: TermName})" if t != termNames.WILDCARD => Some(t)
case q"implicit0($_)" => abort("implicit pattern only supports identifier pattern")
case q"implicit0(..$_)" => abort("implicit pattern only accepts a single parameter")
case q"implicit0($_)" =>
reporter.error(arg.pos, "implicit pattern only supports identifier pattern")
None
case q"implicit0(..$_)" =>
reporter.error(arg.pos, "implicit pattern only accepts a single parameter")
None
case _ => None
}
}
Expand Down

0 comments on commit 2efd18f

Please sign in to comment.