2
官方斯卡拉斑點狗研究小組發現,從(https://d-d.me/talks/scalaworld2015/#/12)斯卡拉斑點狗聯盟類型類daysOfTheWeek例
object DaysOfTheWeek {
object Mon
object Tue
object Wed
object Thu
object Fri
object Sat
object Sun
type Weekend = Sat.type | Sun.type
type Workweek = Mon.type | Tue.type | Wed.type | Thu.type | Fri.type
type All = Weekend | Workweek
}
這個例子如果我使用了最新的斑點狗夜間生成,這是這篇文章的是「0.1.1-20170322- 5fd7a95-NIGHTLY「,那個例子導致了這些錯誤:
Error:(13, 18) Singleton type DaysOfTheWeek.Sat.type is not allowed in a union type
Error:(13, 29) Singleton type DaysOfTheWeek.Sun.type is not allowed in a union type
Error:(14, 19) Singleton type DaysOfTheWeek.Mon.type is not allowed in a union type
Error:(14, 30) Singleton type DaysOfTheWeek.Tue.type is not allowed in a union type
Error:(14, 41) Singleton type DaysOfTheWeek.Wed.type is not allowed in a union type
Error:(14, 52) Singleton type DaysOfTheWeek.Thu.type is not allowed in a union type
Error:(14, 63) Singleton type DaysOfTheWeek.Fri.type is not allowed in a union type
有什麼辦法讓這個官方的例子工作嗎?
這些傳言是多年的一個半老斑點狗是仍然是重大發展中的一個快速發展的目標。使用*舊*快照而不是*新*一個可能會帶來更多運氣。或者,它可能是一個被遺棄的想法的一部分,甚至從未實現過。 –
在Dotty項目的當前主頁dotty.epfl.ch中,那些談話幻燈片仍然佔據着顯着的地位。此外,聯合類型按實現方式列出,並與其他示例一起使用。 – clay
據我瞭解單身人士類型(目前)不允許在工會類型,請參閱https://github.com/lampepfl/dotty/issues/1551 – lutzh