|
Re: Inferr 1. type parameter of inferredType( myExpression ) [message #1723048 is a reply to message #1723044] |
Thu, 11 February 2016 09:17 |
|
Dear Ingo.
Have you tried something like the following code?
var typeReference = inferredType(myExpression)
var type = typeReference.type
var paramType = typeRef(Object)
if (type instanceof JvmTypeParameterDeclarator) {
var pType = type.typeParameters.get(0)
paramType = cloneWithProxis(typeRef(pType))
}
toParameter(it, 'paramName', paramType)
Stéphane.
|
|
|
|
Re: Inferr 1. type parameter of inferredType( myExpression ) [message #1723126 is a reply to message #1723050] |
Thu, 11 February 2016 21:12 |
|
Hi Ingo,
resolving expressions during model inference is not possible (or at least very problematic and will lead to surprising behavior). The reason is that the expressions are resolved against the outside structure, i.e. signatures and the like. So at the time of type inference and overload resolution all signatures must be finalized and no longer changed.
Therefore the method inferrerType(XExpression) really only creates a lazy placeholder which triggers the expression resolution when accessed. We would need to have another placeholder that will return the type argument instead of the type.
Sven
|
|
|
|
Powered by
FUDForum. Page generated in 0.04669 seconds