Skip to content

Commit 0f8bbfa

Browse files
committed
Fix isGlobal and move tests
Move pos tests to pos-custom-args, for symmetry with neg tests.
1 parent 3a2190a commit 0f8bbfa

File tree

8 files changed

+2
-1
lines changed

8 files changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/typer/CheckCaptures.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class CheckCaptures extends RefineTypes:
124124
val isGlobal = ref match
125125
case ref: TypeRef => ref.isRootCapability
126126
case ref: TermRef => ref.prefix != NoPrefix && ref.symbol.hasAnnotation(defn.AbilityAnnot)
127+
case _ => false
127128
val what = if ref.isRootCapability then "universal" else "global"
128129
if isGlobal then
129130
val notAllowed = i" is not allowed to capture the $what capability $ref"

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ class CompilationTests {
3333
compileFilesInDir("tests/pos-special/sourcepath/outer", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
3434
compileFile("tests/pos-special/sourcepath/outer/nested/Test4.scala", defaultOptions.and("-sourcepath", "tests/pos-special/sourcepath")),
3535
compileFilesInDir("tests/pos-special/fatal-warnings", defaultOptions.and("-Xfatal-warnings", "-deprecation", "-feature")),
36-
compileFilesInDir("tests/pos-special/captures", defaultOptions.and("-Ycc")),
3736
compileFile("tests/pos-special/avoid-warn-deprecation.scala", defaultOptions.and("-Xfatal-warnings", "-feature")),
3837
compileFilesInDir("tests/pos-special/spec-t5545", defaultOptions),
3938
compileFilesInDir("tests/pos-special/strawman-collections", allowDeepSubtypes),
4039
compileFilesInDir("tests/pos-special/isInstanceOf", allowDeepSubtypes.and("-Xfatal-warnings")),
4140
compileFilesInDir("tests/new", defaultOptions),
4241
compileFilesInDir("tests/pos-scala2", scala2CompatMode),
42+
compileFilesInDir("tests/pos-custome-args/captures", defaultOptions.and("-Ycc")),
4343
compileFilesInDir("tests/pos-custom-args/erased", defaultOptions.and("-language:experimental.erasedDefinitions")),
4444
compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init")),
4545
compileFilesInDir("tests/pos-deep-subtype", allowDeepSubtypes),

0 commit comments

Comments
 (0)