[英]What is the “underlying type” in Scala?
Recently I have stumbled upon an scalac error message complaining about two types not being the same though the "underlying type" is the same. 最近,我偶然发现了一个scalac错误消息,尽管“基本类型”相同,但抱怨两种类型不相同。 Regardless of the error and its specifics, I'm curious about this "underlying type".
不管错误及其具体内容如何,我都对这种“底层类型”感到好奇。 What is it ?
它是什么 ?
For a singleton type x.type
it's the type of x
. 对于单例类型
x.type
它是x
的类型。 For example, if you have val x: Int
the underlying type of x.type
is Int
. 例如,如果您具有
val x: Int
,则x.type
的基础类型为Int
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.