File tree 2 files changed +16
-2
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1158,7 +1158,7 @@ object Types {
1158
1158
* Overridden and cached in OrType.
1159
1159
*/
1160
1160
def atoms (implicit ctx : Context ): Set [Type ] = dealias match {
1161
- case tp : SingletonType if tp.isStable =>
1161
+ case tp : SingletonType =>
1162
1162
def normalize (tp : Type ): Type = tp match {
1163
1163
case tp : SingletonType =>
1164
1164
tp.underlying.dealias match {
@@ -1172,7 +1172,7 @@ object Types {
1172
1172
case _ => tp
1173
1173
}
1174
1174
val underlyingAtoms = tp.underlying.atoms
1175
- if (underlyingAtoms.isEmpty) Set .empty + normalize(tp)
1175
+ if (underlyingAtoms.isEmpty && tp.isStable ) Set .empty + normalize(tp)
1176
1176
else underlyingAtoms
1177
1177
case tp : ExprType => tp.resType.atoms
1178
1178
case tp : OrType => tp.atoms // `atoms` overridden in OrType
Original file line number Diff line number Diff line change
1
+ class Z
2
+ class O
3
+ object Test0 {
4
+ def foo (x : Z | O ) = ()
5
+ def bar : Z | O = O ()
6
+ foo(bar)
7
+ }
8
+
9
+ object Test {
10
+ def foo (x : 0 | 1 ) = ()
11
+ def bar : 0 | 1 = 0
12
+ foo(bar)
13
+ }
14
+
You can’t perform that action at this time.
0 commit comments