Regression: class with no object shadows outer object
See original GitHub issueCompiler version
3.0.0-RC1
Minimized code
sealed trait Children
object Children {
sealed trait None extends Children
sealed trait Varargs extends Children
}
sealed abstract class CtorType {
type ChildrenType <: Children
}
object CtorType {
final class X() extends CtorType {
override type ChildrenType = Children.None
}
final class Children() extends CtorType {
override type ChildrenType = Children.Varargs
}
}
Output
-- Error: x.scala:13:33 --------------------------------------------------------
13 | override type ChildrenType = Children.None
| ^^^^^^^^
| Reference to creator proxy for class Children in object CtorType
| shadows outer reference to object Children
-- Error: x.scala:17:33 --------------------------------------------------------
17 | override type ChildrenType = Children.Varargs
| ^^^^^^^^
| Reference to creator proxy for class Children in object CtorType
| shadows outer reference to object Children
2 errors found
Expectation
It should compiles as it does in Scala 2.x.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to resolve the error "outer reference shadow" while ...
How to resolve the error "outer reference shadow" while referring to another object within the class in Scala? - Stack Overflow. Stack Overflow ......
Read more >Cannot instantiate local class whose name shadows outer ...
I have a source file defining a class A. A second file would like to demonstrate a small variation of A, not enough...
Read more >Create Instance of Outer Class When Inner Class Shadows ...
When I execute new A(); in anonymous window, I get inner class printed, but I need the instance of outer B1 class. One...
Read more >Chapter 6
Now we can extend our discussion of the design of classes and objects ... These activities are not strictly linear – they overlap...
Read more >Activity 4 - Shadow Tracing
Summary: The class will measure their shadow lengths outside three times ... Objective 3.01 Observe that light travels in a straight line until...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
But “constructor proxy companions cannot be used as values by themselves”.
The documentation also says:
It’s nice that Scala 3 thinks of the poor StackOverflow answerers who came in after all the high-reputation answers were already taken. Some nice generalizations with just enough differences to thoroughly confuse people should do the trick.
The bug may be where the spec turns to their date in the darkened theater and whispers with menacing assurance: