forked from scala/scala
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class Test { | ||
class A[T] | ||
class B[T](val a: A[T]) | ||
|
||
case class CaseClass[T](x: T) | ||
|
||
def break(existB: B[_]) = | ||
CaseClass(existB.a) match { case CaseClass(_) => } | ||
} | ||
|
||
class Foo { | ||
trait Init[T] | ||
class ScopedKey[T] extends Init[T] | ||
|
||
trait Setting[T] { | ||
val key: ScopedKey[T] | ||
} | ||
|
||
case class ScopedKey1[T](val foo: Init[T]) extends ScopedKey[T] | ||
|
||
val scalaHome: Setting[Option[String]] = null | ||
val scalaVersion: Setting[String] = null | ||
|
||
def testPatternMatch(s: Setting[_]) { | ||
s.key match { | ||
case ScopedKey1(scalaHome.key | scalaVersion.key) => () | ||
} | ||
} | ||
} | ||
|
||
class Test2 { | ||
type AnyCyclic = Execute[Task]#CyclicException[_] | ||
|
||
trait Task[T] | ||
|
||
trait Execute[A[_] <: AnyRef] { | ||
class CyclicException[T](val caller: A[T], val target: A[T]) | ||
} | ||
|
||
def convertCyclic(c: AnyCyclic): String = | ||
(c.caller, c.target) match { | ||
case (caller: Task[_], target: Task[_]) => "bazinga!" | ||
} | ||
} | ||
|