Types 类型推断中的XText链接依赖项

Types 类型推断中的XText链接依赖项,types,dsl,type-inference,xtext,Types,Dsl,Type Inference,Xtext,在我的实验中,当存在跨多个XExpression块的依赖链时,XText似乎无法解析变量类型 一个简单的例子来说明。我有一个语法: grammar eg.types.inference.TypeInferenceExample with org.eclipse.xtext.xbase.Xbase generate typeInferenceExample "example.org/types/inference/TypeInferenceExample" Model: blocks

在我的实验中,当存在跨多个XExpression块的依赖链时,XText似乎无法解析变量类型

一个简单的例子来说明。我有一个语法:

grammar eg.types.inference.TypeInferenceExample with org.eclipse.xtext.xbase.Xbase 

generate typeInferenceExample "example.org/types/inference/TypeInferenceExample"

Model:
    blocks += Block*
;

Block:
    '{'
        'name' ':' name=QualifiedName
        'from' ':' ('none' | from=[Block|QualifiedName])
        'block' ':' expression=XBlockExpression
    '}'
; 
接口:

package eg.lib;

public interface IModelBlock {
    public void push(org.eclipse.xtext.xbase.lib.Pair<String, ?> toPush);
}
当我为这个DSL创建一个简单的示例时,例如:

{
    name : BlockOne
    from : none
    block : {
        val i = 42 * 3.6
        push("index" -> i)
    }
}

{
    name : BlockTwo
    from : BlockOne
    block : {
        val res = "Another Value from " + index
        push("result" -> res)
    }
}
代码生成得很好(类型推断在生成输出Java时成功地计算出indexres的类型)。我正在使用
BlockOne
上的
push
调用中的对来推断
BlockTwo
调用方法上的接口。这个
push
方法来自上面的
IModelBlock
接口。如果将第三个块添加到此示例中,则:

{
    name : BlockThree
    from : BlockTwo
    block : {
        val out = "This one came from: " + result
        push("out" -> out)
    }
}
推理失败,出现
UnsupportedOperationException:TODO:导入类型解析上的函数句柄,该句柄将委托给最佳可用(当前但不断变化)结果
(来自
OnChangeExcingCache.ExecutWithOutCacheClear
CachingBatchTypeResolver.resolveTypes

在XText中,我是否应该使用其他技术来推导具有链式依赖关系的变量类型?


谢谢你的帮助

这似乎是您使用的版本中的一个bug。尝试使用最新版本。

我刚刚尝试使用XText 2.5.0(根据文档,是R20131210906),但它抛出了相同的异常。我是否缺少更新站点?
{
    name : BlockThree
    from : BlockTwo
    block : {
        val out = "This one came from: " + result
        push("out" -> out)
    }
}