File tree 2 files changed +13
-4
lines changed
compiler/src/dotty/tools/dotc/typer
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -176,8 +176,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
176
176
177
177
* In addition:
178
178
* - if we are in a constructor of a pattern, we ignore all definitions
179
- * which are methods and not accessors (note: if we don't do that
180
- * case x :: xs in class List would return the :: method).
179
+ * which are parameterized (including nullary) methods and not accessors
180
+ * (note: if we don't do that case x :: xs in class List would return the :: method).
181
181
* - Members of the empty package can be accessed only from within the empty package.
182
182
* Note: it would be cleaner to never nest package definitions in empty package definitions,
183
183
* but then we'd have to give up the fiction that a compilation unit consists of
@@ -187,9 +187,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
187
187
* tools, we did not want to take that step.
188
188
*/
189
189
def qualifies (denot : Denotation ): Boolean =
190
+ def isRealMethod (sd : SingleDenotation ): Boolean =
191
+ sd.symbol.is(Method , butNot = Accessor ) && ! sd.info.isParameterless
190
192
reallyExists(denot)
191
- && (! pt.isInstanceOf [UnapplySelectionProto ]
192
- || denot.hasAltWith(sd => ! sd.symbol.is(Method , butNot = Accessor )))
193
+ && (! pt.isInstanceOf [UnapplySelectionProto ] || denot.hasAltWith(! isRealMethod(_)))
193
194
&& ! denot.symbol.is(PackageClass )
194
195
&& {
195
196
var owner = denot.symbol.maybeOwner
Original file line number Diff line number Diff line change
1
+ object Test :
2
+ enum E [T ]:
3
+ case A (i : Int )
4
+
5
+ export E .*
6
+
7
+ def f (x : E [Int ]) = x match
8
+ case A (i) => i
You can’t perform that action at this time.
0 commit comments