Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1624 from adriaanm/paulp-issue/5330-2.10.x
SI-5330, SI-6014 deal with existential self-type
- Loading branch information
Showing
5 changed files
with
61 additions
and
3 deletions.
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,22 @@ | ||
trait FM[A] { | ||
def map(f: A => Any) | ||
} | ||
|
||
trait M[A] extends FM[A] { | ||
def map(f: A => Any) | ||
} | ||
|
||
trait N[A] extends FM[A] | ||
|
||
object test { | ||
def kaboom(xs: M[_]) = xs map (x => ()) // missing parameter type. | ||
|
||
def okay1[A](xs: M[A]) = xs map (x => ()) | ||
def okay2(xs: FM[_]) = xs map (x => ()) | ||
def okay3(xs: N[_]) = xs map (x => ()) | ||
} | ||
|
||
class CC2(xs: List[_]) { | ||
def f(x1: Any, x2: Any) = null | ||
def g = xs map (x => f(x, x)) | ||
} |
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,6 @@ | ||
abstract trait Base { | ||
def foo: this.type | ||
}; | ||
class Derived[T] extends Base { | ||
def foo: Nothing = sys.error("!!!") | ||
} |
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,5 @@ | ||
object t5330c { | ||
val s: Set[_ >: Char] = Set('A') | ||
s forall ("ABC" contains _) | ||
s.forall( c => "ABC".toSeq.contains( c )) | ||
} |
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,13 @@ | ||
object Test { | ||
case class CC[T](key: T) | ||
type Alias[T] = Seq[CC[T]] | ||
|
||
def f(xs: Seq[CC[_]]) = xs map { case CC(x) => CC(x) } // ok | ||
def g(xs: Alias[_]) = xs map { case CC(x) => CC(x) } // fails | ||
// ./a.scala:11: error: missing parameter type for expanded function | ||
// The argument types of an anonymous function must be fully known. (SLS 8.5) | ||
// Expected type was: ? | ||
// def g(xs: Alias[_]) = xs map { case CC(x) => CC(x) } // fails | ||
// ^ | ||
// one error found | ||
} |