diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-11-06 15:21:19 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2014-11-07 12:00:48 +0100 |
commit | a34be74e8f2630f1862a34e538cbe1162d279e5e (patch) | |
tree | a404c5fb955bf1fd1f192895cee32adb805544df /test/files/neg/sammy_error_exist_no_crash.check | |
parent | 9c36a76171d497fe277030d2f682f927ae2657f4 (diff) | |
download | scala-a34be74e8f2630f1862a34e538cbe1162d279e5e.tar.gz scala-a34be74e8f2630f1862a34e538cbe1162d279e5e.tar.bz2 scala-a34be74e8f2630f1862a34e538cbe1162d279e5e.zip |
[sammy] use correct type for method to override
Don't naively derive types for the single method's signature
from the provided function's type, as it may be a subtype
of the method's MethodType.
Instead, once the sam class type is fully defined, determine
the sam's info as seen from the class's type, and use those
to generate the correct override.
```
scala> Arrays.stream(Array(1, 2, 3)).map(n => 2 * n + 1).average.ifPresent(println)
5.0
scala> IntStream.range(1, 4).forEach(println)
1
2
3
```
Also, minimal error reporting
Can't figure out how to do it properly, but some reporting
is better than crashing. Right? Test case that illustrates
necessity of the clumsy stop gap `if (block exists (_.isErroneous))`
enclosed as `sammy_error_exist_no_crash`
added TODO for repeated and by-name params
Diffstat (limited to 'test/files/neg/sammy_error_exist_no_crash.check')
-rw-r--r-- | test/files/neg/sammy_error_exist_no_crash.check | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/files/neg/sammy_error_exist_no_crash.check b/test/files/neg/sammy_error_exist_no_crash.check new file mode 100644 index 0000000000..a0d2237ce0 --- /dev/null +++ b/test/files/neg/sammy_error_exist_no_crash.check @@ -0,0 +1,6 @@ +sammy_error_exist_no_crash.scala:5: error: Could not derive subclass of F[? >: String] + (with SAM `def method apply(s: String)Int`) + based on: ((x$1: String) => x$1.<parseInt: error>). + bar(_.parseInt) + ^ +one error found |