You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is a bug or works as intended. The same code compiles in Scala 2 and I don't know why it shouldn't in Scala 3 - but I might be just unaware of a particular limitation/restriction introduced in dotty.
caseclassTable(owner: Owner.Id)
caseclassOwner(owner: Owner.Id) // type Id is not a member of object Playground.OwnertraitTyped[Tag] {
typeId=String
}
objectOwnerextendsTyped[Owner] {
//type Id = String
}
yurique
changed the title
type defined in a trait "not found" in an object extending the trait under certain circumstances
type defined in a trait is "not found" in an object extending the trait under certain circumstances
Aug 9, 2024
yurique
changed the title
type defined in a trait is "not found" in an object extending the trait under certain circumstances
type defined in a trait is "not found" in an object that extends the trait (under certain circumstances)
Aug 9, 2024
yurique
changed the title
type defined in a trait is "not found" in an object that extends the trait (under certain circumstances)
a type defined in a trait is "not found" in an object that extends the trait (under certain circumstances)
Aug 9, 2024
Only the second case class declaration fails to compile, a third one does not raise any compilation error (only an error for B declaration is reported in scastie for the following snippet) (https://scastie.scala-lang.org/NyuB/45vwz4atRLGpOwmsffERZg/2)
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.3.3
,3.4.2
,3.5.0-RC7
,3.5.1-RC1
Preface
I'm not sure if this is a bug or works as intended. The same code compiles in Scala 2 and I don't know why it shouldn't in Scala 3 - but I might be just unaware of a particular limitation/restriction introduced in dotty.
Minimized code
(https://scastie.scala-lang.org/a2YCoAw8TOyOXi2Q7vl5Gg)
Output
(from scastie)
Expectation
Expectation is for this code to compile.
Observations:
Owner.Id
- it compiles (https://scastie.scala-lang.org/X4cRDtzcTUa0ZrIBkowU6w)type Id
is defined directly in the object (the commented out line) - it compiles (https://scastie.scala-lang.org/noCBIv1TQUGeNBuSHoFdKQ)Typed
is not theOwner
class - it compiles (https://scastie.scala-lang.org/0Y0hTN0oQtuQjT7YVBfpVg)The text was updated successfully, but these errors were encountered: