Open bjansen opened 8 years ago
Now, interestingly, Ceylon's type system can handle things like this, you can write an anonymous function like:
<T>(T foo) => print("hello")
Or you can take a reference to a generic method, without providing type arguments.
However, this is not functionality that is currently supported on the JVM. These are rank-2 types that we have not implemented support for yet.
So I would say: "It's not a SAM".
More info about this thing here: https://ceylon-lang.org/blog/2015/06/03/generic-function-refs/#references_to_generic_functions
I'm ignoring them for now in ceylon-ide-intellij, but I can still revert that when/if we decide to support them.
Given this interface:
The model loader's current behavior is to not consider this as a SAM. In theory, I think it could be possible to coerce it to a
Anything<T>(T)
, but that doesn't see possible at the moment.IntelliJ's
LambdaUtil
says that this interface is a valid functional interface, so in ceylon-ide-intellij I can create the correspondingFunctionalInterfaceType
. When I try to use it, I get errors like these:I'm not sure who's right or wrong:
CeylonModelLoader
considerMySam
as a valid functional interface?IdeaModelLoader
ignore functional interfaces that have parameterized methods?