File tree 1 file changed +2
-2
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -715,7 +715,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
715
715
&& ctx.owner.owner.unforcedDecls.lookup(tree.name).exists
716
716
then // we are in the arguments of a this(...) constructor call
717
717
errorTree(tree, em " $tree is not accessible from constructor arguments " )
718
- else if ctx.mode.is(Mode .InCaptureSet ) then
718
+ else if name.isTermName && ctx.mode.is(Mode .InCaptureSet ) then
719
719
// If we are in a capture set and the identifier is not a term name,
720
720
// try to type it with the same name but as a type
721
721
typed(untpd.makeCapsOf(untpd.cpy.Ident (tree)(name.toTypeName)), pt)
@@ -927,7 +927,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
927
927
// Otherwise, if we are in a capture set, try to type it as a capture variable
928
928
// reference (as selecting a type name).
929
929
def trySelectTypeInCaptureSet () =
930
- if ctx.mode.is(Mode .InCaptureSet ) && tree0.name.isTypeName then
930
+ if tree0.name.isTermName && ctx.mode.is(Mode .InCaptureSet ) then
931
931
typedSelectWithAdapt(untpd.cpy.Select (tree0)(qual, tree0.name.toTypeName), pt, qual)
932
932
else EmptyTree
933
933
You can’t perform that action at this time.
0 commit comments