|
Scala example source code file (bug1957.scala)
The Scala bug1957.scala source codeobject Test { abstract class Settings {} abstract class Grist { self => type settingsType <: Settings type moduleType <: Module {type settingsType = self.settingsType} val module: moduleType } abstract class Tool { self => type settingsType <: Settings type moduleType = Module { type settingsType = self.settingsType } type gristType = Grist { type moduleType <: self.moduleType; type settingsType <: self.settingsType } def inputGrist: List[gristType] } abstract class Module { self => type settingsType <: Settings final type commonModuleType = Module {type settingsType = self.settingsType} type selfType >: self.type <: commonModuleType // BTW: if we use the commented out type declarations, the code compiles successfully // type gristType = Grist {type settingsType <: self.settingsType; type moduleType <: commonModuleType } val tools: List[Tool {type settingsType = self.settingsType}] protected def f: List[commonModuleType] = { val inputGrists = tools.flatMap(_.inputGrist) // val inputGrists: List[gristType] = inputGrists.map(_.module) } } } Other Scala examples (source code examples)Here is a short list of links related to this Scala bug1957.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.