diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-17 17:16:28 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-26 22:54:07 -0700 |
commit | 040c0434d456dd75a174147d8a0c4cab37266ba6 (patch) | |
tree | f5e0dd086c2610d5d56dd9701028e11665ac2671 /spec | |
parent | a2795ba77c0e7b56b0a522eae0cca298af0ac1f1 (diff) | |
download | scala-040c0434d456dd75a174147d8a0c4cab37266ba6.tar.gz scala-040c0434d456dd75a174147d8a0c4cab37266ba6.tar.bz2 scala-040c0434d456dd75a174147d8a0c4cab37266ba6.zip |
More fixes based on feedback by Lukas
Crucially, the fully-defined expected type must be checked for
conformance to the original expected type!!
The logic in adaptToSam that checks whether pt is fully defined
probably needs some more thought. See pos/t8310 for a good test
case. Argument type checking is a challenge, as we first check
against a lenient pt (this lenient expected type has wildcards,
and thus is not fully defined, but we should still consider sam
adaptation a success even if we end up with wildcards for some
unknown type parameters, they should be determined later).
Diffstat (limited to 'spec')
-rw-r--r-- | spec/03-types.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/03-types.md b/spec/03-types.md index 16c48bcf6c..e2a6523dff 100644 --- a/spec/03-types.md +++ b/spec/03-types.md @@ -986,7 +986,7 @@ def foo(x: ToString): Unit trait ToString { def convert(x: Int): String } ``` -The application `foo(_.toString)` [resolves](06-expressions.html#overloading-resolution) to the first overload, +The application `foo((x: Int) => x.toString)` [resolves](06-expressions.html#overloading-resolution) to the first overload, as it's more specific: - `Int => String` is compatible to `ToString` -- when expecting a value of type `ToString`, you may pass a function literal from `Int` to `String`, as it will be SAM-converted to said function; - `ToString` is not compatible to `Int => String` -- when expecting a function from `Int` to `String`, you may not pass a `ToString`. |