File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 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
176176
177177 * In addition:
178178 * - 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).
181181 * - Members of the empty package can be accessed only from within the empty package.
182182 * Note: it would be cleaner to never nest package definitions in empty package definitions,
183183 * 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
187187 * tools, we did not want to take that step.
188188 */
189189 def qualifies (denot : Denotation ): Boolean =
190+ def isRealMethod (sd : SingleDenotation ): Boolean =
191+ sd.symbol.is(Method , butNot = Accessor ) && ! sd.info.isParameterless
190192 reallyExists(denot)
191- && (! pt.isInstanceOf [UnapplySelectionProto ]
192- || denot.hasAltWith(sd => ! sd.symbol.is(Method , butNot = Accessor )))
193+ && (! pt.isInstanceOf [UnapplySelectionProto ] || denot.hasAltWith(! isRealMethod(_)))
193194 && ! denot.symbol.is(PackageClass )
194195 && {
195196 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