Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes a problem with an extractor object overloaded by a regular def
- Loading branch information
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
trait TreesBase { | ||
type Tree | ||
|
||
type Apply <: Tree | ||
|
||
val Apply: ApplyExtractor | ||
|
||
abstract class ApplyExtractor { | ||
def apply(x: Int): Apply | ||
def unapply(apply: Apply): Option[Int] | ||
} | ||
} | ||
|
||
trait TreesApi extends TreesBase { | ||
def Apply(x: String) | ||
} | ||
|
||
class Universe extends TreesApi { | ||
abstract class Tree | ||
case class Apply(x: Int) extends Tree | ||
object Apply extends ApplyExtractor | ||
def Apply(x: String) = Apply(x.toInt) | ||
} | ||
|
||
object Test extends App { | ||
def foo(tapi: TreesApi) { | ||
import tapi._ | ||
def bar(tree: Tree) { | ||
val Apply(x) = tree | ||
} | ||
} | ||
} |