File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 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
715715 && ctx.owner.owner.unforcedDecls.lookup(tree.name).exists
716716 then // we are in the arguments of a this(...) constructor call
717717 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
719719 // If we are in a capture set and the identifier is not a term name,
720720 // try to type it with the same name but as a type
721721 typed(untpd.makeCapsOf(untpd.cpy.Ident (tree)(name.toTypeName)), pt)
@@ -927,7 +927,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
927927 // Otherwise, if we are in a capture set, try to type it as a capture variable
928928 // reference (as selecting a type name).
929929 def trySelectTypeInCaptureSet () =
930- if ctx.mode.is(Mode .InCaptureSet ) && tree0.name.isTypeName then
930+ if tree0.name.isTermName && ctx.mode.is(Mode .InCaptureSet ) then
931931 typedSelectWithAdapt(untpd.cpy.Select (tree0)(qual, tree0.name.toTypeName), pt, qual)
932932 else EmptyTree
933933
You can’t perform that action at this time.
0 commit comments