Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
scala类型推断失败_Scala_Type Inference_Type Systems - Fatal编程技术网

scala类型推断失败

scala类型推断失败,scala,type-inference,type-systems,Scala,Type Inference,Type Systems,在使用Scala一段时间后,我认为我已经了解了关于类型推断的所有内容,但显然不是。我不明白为什么编译器不能推断以下情况的类型: trait低级别[A] trait HighLevel[L这也有效:def method[A,L@michaJlS是的,但不幸的是,在您的例子中,H的类型信息将在函数中丢失。这看起来像是一个编译器错误。请注意,您的示例使用dotty可以很好地编译。

在使用Scala一段时间后,我认为我已经了解了关于类型推断的所有内容,但显然不是。我不明白为什么编译器不能推断以下情况的类型:

trait低级别[A]

trait HighLevel[L这也有效:
def method[A,L@michaJlS是的,但不幸的是,在您的例子中,H的类型信息将在函数中丢失。这看起来像是一个编译器错误。请注意,您的示例使用
dotty
可以很好地编译。