diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-17 11:56:14 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-26 22:54:10 -0700 |
commit | f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966 (patch) | |
tree | 18a9cf588cd9e6dbe0a3815258f4dede2af3c772 /spec | |
parent | 040c0434d456dd75a174147d8a0c4cab37266ba6 (diff) | |
download | scala-f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966.tar.gz scala-f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966.tar.bz2 scala-f922f367d58b3ba6bbb4cb0864ce82c5cd6f7966.zip |
Additional SAM restrictions identified by Jason
Also test roundtripping serialization of a lambda that targets a
SAM that's not FunctionN (it should make no difference).
Diffstat (limited to 'spec')
-rw-r--r-- | spec/06-expressions.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/06-expressions.md b/spec/06-expressions.md index f69c75bb96..2b93842a25 100644 --- a/spec/06-expressions.md +++ b/spec/06-expressions.md @@ -1365,8 +1365,11 @@ An expression `(p1, ..., pN) => body` of function type `(T1, ..., TN) => T` is s It follows that: - the type `S` must have an accessible, no-argument, constructor; - - the class of `S` must not be `@specialized`; - - the class of `S` must not be nested or local (it must not capture its environment). + - the class of `S` must not be nested or local (it must not capture its environment, as that precludes a zero-argument constructor). + +Additionally (the following are implementation restrictions): + - `S`'s [erases](03-types.html#type-erasure) to a trait (this allows for a more efficient encoding when the JVM is the underlying platform); + - the class of `S` must not be `@specialized`. ### Method Conversions |