File tree 3 files changed +9
-5
lines changed
compiler/src/dotty/tools/dotc/parsing
3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ object Scanners {
186
186
error(s " illegal combination of -rewrite targets: ${enabled(0 ).name} and ${enabled(1 ).name}" )
187
187
}
188
188
189
- var languageImportContext : Context = ctx
189
+ private var myLanguageImportContext : Context = ctx
190
+ def languageImportContext = myLanguageImportContext
191
+ final def languageImportContext_= (c : Context ) = myLanguageImportContext = c
190
192
191
193
def featureEnabled (name : TermName ) = Feature .enabled(name)(using languageImportContext)
192
194
def erasedEnabled = featureEnabled(Feature .erasedTerms) || ctx.settings.YerasedTerms .value
@@ -912,7 +914,9 @@ object Scanners {
912
914
reset()
913
915
next
914
916
915
- class LookaheadScanner () extends Scanner (source, offset)
917
+ class LookaheadScanner () extends Scanner (source, offset) {
918
+ override def languageImportContext = Scanner .this .languageImportContext
919
+ }
916
920
917
921
/** Skip matching pairs of `(...)` or `[...]` parentheses.
918
922
* @pre The current token is `(` or `[`
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ object Tokens extends TokensCommon {
248
248
249
249
final val modifierTokensOrCase : TokenSet = modifierTokens | BitSet (CASE )
250
250
251
- final val modifierFollowers = modifierTokens | defIntroTokens
251
+ final val modifierFollowers = modifierTokensOrCase | defIntroTokens
252
252
253
253
/** Is token only legal as start of statement (eof also included)? */
254
254
final val mustStartStatTokens : TokenSet = defIntroTokens | modifierTokens | BitSet (IMPORT , EXPORT , PACKAGE )
Original file line number Diff line number Diff line change @@ -29,6 +29,6 @@ enum Foo11 {
29
29
protected case C9 // ok
30
30
}
31
31
32
- enum Foo12 { // error: enums must contain at least one case
33
- inline case C10 () // error // error (inline treated as ident here)
32
+ enum Foo12 {
33
+ inline case C10 () // error: only access modifiers allowed
34
34
}
You can’t perform that action at this time.
0 commit comments