@@ -14,7 +14,7 @@ final class Dialect private[meta] (
1414 private [meta] val unquoteType : UnquoteType ,
1515 // Are `&` intersection types supported by this dialect?
1616 @ deprecated(" allowAndTypes unneeded, infix types are supported" , " 4.5.1" )
17- val allowAndTypes : Boolean , // unused
17+ private [meta] val allowAndTypes : Boolean , // unused
1818 // Are extractor varargs specified using ats, i.e. is `case Extractor(xs @ _*)` legal or not?
1919 val allowAtForExtractorVarargs : Boolean ,
2020 // Can case classes be declared without a parameter list?
@@ -41,7 +41,7 @@ final class Dialect private[meta] (
4141 val allowLiteralTypes : Boolean ,
4242 // Are `|` (union types) supported by this dialect?
4343 @ deprecated(" allowOrTypes unneeded, infix types are supported" , " 4.5.1" )
44- val allowOrTypes : Boolean , // unused
44+ private [meta] val allowOrTypes : Boolean , // unused
4545 // Are naked underscores allowed after $ in pattern interpolators, i.e. is `case q"$_ + $_" =>` legal or not?
4646 val allowSpliceUnderscores : Boolean ,
4747 // Are terms on the top level supported by this dialect?
@@ -58,13 +58,13 @@ final class Dialect private[meta] (
5858 // def f[A <% Int](a: A)
5959 // Removed in Dotty.
6060 @ deprecated(" allowViewBounds unneeded, it was only used for an error" , " >4.10.2" )
61- val allowViewBounds : Boolean ,
61+ private [meta] val allowViewBounds : Boolean ,
6262 // Are XML literals supported by this dialect?
6363 // We plan to deprecate XML literal syntax, and some dialects
6464 // might go ahead and drop support completely.
6565 val allowXmlLiterals : Boolean ,
6666 @ deprecated(" toplevelSeparator has never been used" , " >4.4.35" )
67- val toplevelSeparator : String , // unused
67+ private [meta] val toplevelSeparator : String , // unused
6868 // Are numeric literal underscore separators, i.e. `1_000_000` legal or not?
6969 val allowNumericLiteralUnderscoreSeparators : Boolean ,
7070 // Can try body contain any expression? (2.13.1 https://github.com/scala/scala/pull/8071)
@@ -96,7 +96,7 @@ final class Dialect private[meta] (
9696 val allowQuestionMarkAsTypeWildcard : Boolean ,
9797 // Dotty rejects placeholder as Type parameter
9898 @ deprecated(" allowTypeParamUnderscore not used" , " 4.14.1" )
99- val allowTypeParamUnderscore : Boolean ,
99+ private [meta] val allowTypeParamUnderscore : Boolean , // TODO: deprecate, not used
100100 // Dotty allows by-name repeated parameters
101101 val allowByNameRepeatedParameters : Boolean ,
102102 // Dotty allows lazy val abstract values
@@ -189,6 +189,7 @@ final class Dialect private[meta] (
189189 // - add new `withX()` method to allow overriding that specific field.
190190 // - add new `x = FIELD_DEFAULT_VALUE` in the `def this()` constructor below.
191191
192+ @ deprecated(" Use Dialect.empty (or any of the predefined dialects) and `.withXxx` methods" )
192193 def this (
193194 allowAndTypes : Boolean , // unused
194195 allowAtForExtractorVarargs : Boolean ,
@@ -293,7 +294,7 @@ final class Dialect private[meta] (
293294 def allowMultilinePrograms : Boolean = unquoteType.isMultiline
294295
295296 @ deprecated(" allowAndTypes unneeded, infix types are supported" , " 4.5.1" )
296- def withAllowAndTypes (newValue : Boolean ): Dialect = this
297+ private [meta] def withAllowAndTypes (newValue : Boolean ): Dialect = this
297298 def withAllowAtForExtractorVarargs (newValue : Boolean ): Dialect =
298299 privateCopy(allowAtForExtractorVarargs = newValue)
299300 def withAllowCaseClassWithoutParameterList (newValue : Boolean ): Dialect =
@@ -311,7 +312,7 @@ final class Dialect private[meta] (
311312 def withAllowLiteralTypes (newValue : Boolean ): Dialect = privateCopy(allowLiteralTypes = newValue)
312313 def withAllowMultilinePrograms (newValue : Boolean ): Dialect = ???
313314 @ deprecated(" allowOrTypes unneeded, infix types are supported" , " 4.5.1" )
314- def withAllowOrTypes (newValue : Boolean ): Dialect = this
315+ private [meta] def withAllowOrTypes (newValue : Boolean ): Dialect = this
315316 def withAllowPatUnquotes (newValue : Boolean ): Dialect = ???
316317 def withAllowSpliceUnderscores (newValue : Boolean ): Dialect =
317318 privateCopy(allowSpliceUnderscores = newValue)
@@ -323,10 +324,10 @@ final class Dialect private[meta] (
323324 privateCopy(allowTraitParameters = newValue)
324325 def withAllowTypeLambdas (newValue : Boolean ): Dialect = privateCopy(allowTypeLambdas = newValue)
325326 @ deprecated(" allowViewBounds unneeded, it was only used for an error" , " >4.10.2" )
326- def withAllowViewBounds (newValue : Boolean ): Dialect = this
327+ private [meta] def withAllowViewBounds (newValue : Boolean ): Dialect = this
327328 def withAllowXmlLiterals (newValue : Boolean ): Dialect = privateCopy(allowXmlLiterals = newValue)
328329 @ deprecated(" toplevelSeparator has never been used" , " >4.4.35" )
329- def withToplevelSeparator (newValue : String ): Dialect = this
330+ private [meta] def withToplevelSeparator (newValue : String ): Dialect = this
330331 def withAllowNumericLiteralUnderscoreSeparators (newValue : Boolean ): Dialect =
331332 privateCopy(allowNumericLiteralUnderscoreSeparators = newValue)
332333 def withAllowTryWithAnyExpr (newValue : Boolean ): Dialect =
@@ -351,9 +352,9 @@ final class Dialect private[meta] (
351352 def withAllowQuestionMarkAsTypeWildcard (newValue : Boolean ): Dialect =
352353 privateCopy(allowQuestionMarkAsTypeWildcard = newValue)
353354 @ deprecated(" use allowQuestionMarkAsTypeWildcard" , " >4.5.13" )
354- def allowQuestionMarkPlaceholder : Boolean = allowQuestionMarkAsTypeWildcard
355+ private [meta] def allowQuestionMarkPlaceholder : Boolean = allowQuestionMarkAsTypeWildcard
355356 @ deprecated(" use withAllowQuestionMarkAsTypeWildcard" , " >4.5.13" )
356- def withAllowQuestionMarkPlaceholder (newValue : Boolean ): Dialect =
357+ private [meta] def withAllowQuestionMarkPlaceholder (newValue : Boolean ): Dialect =
357358 withAllowQuestionMarkAsTypeWildcard(newValue)
358359
359360 @ deprecated(" allowTypeParamUnderscore not used" , " 4.14.1" )
@@ -400,10 +401,11 @@ final class Dialect private[meta] (
400401 def withAllowStarAsTypePlaceholder (newValue : Boolean ): Dialect =
401402 privateCopy(allowStarAsTypePlaceholder = newValue)
402403 @ deprecated(" use withAllowUnderscoreAsTypePlaceholder" , " >4.5.13" )
403- def withAllowPlusMinusUnderscoreAsPlaceholder (newValue : Boolean ): Dialect =
404+ private [meta] def withAllowPlusMinusUnderscoreAsPlaceholder (newValue : Boolean ): Dialect =
404405 withAllowUnderscoreAsTypePlaceholder(newValue)
405406 @ deprecated(" use allowUnderscoreAsTypePlaceholder" , " >4.5.13" )
406- def allowPlusMinusUnderscoreAsPlaceholder : Boolean = allowUnderscoreAsTypePlaceholder
407+ private [meta] def allowPlusMinusUnderscoreAsPlaceholder : Boolean =
408+ allowUnderscoreAsTypePlaceholder
407409
408410 def withAllowGivenImports (newValue : Boolean ): Dialect = privateCopy(allowGivenImports = newValue)
409411
@@ -681,7 +683,7 @@ final class Dialect private[meta] (
681683 this .allowImprovedTypeClassesSyntax == that.allowImprovedTypeClassesSyntax
682684
683685 @ deprecated(" Use withX method instead" , " 4.3.11" )
684- def copy (
686+ private [meta] def copy (
685687 allowAndTypes : Boolean = true , // unused
686688 allowAtForExtractorVarargs : Boolean = this .allowAtForExtractorVarargs,
687689 allowCaseClassWithoutParameterList : Boolean = this .allowCaseClassWithoutParameterList,
@@ -736,6 +738,32 @@ final class Dialect private[meta] (
736738}
737739
738740object Dialect extends InternalDialect {
741+ val empty : Dialect = new Dialect (
742+ allowAndTypes = false ,
743+ allowAtForExtractorVarargs = false ,
744+ allowCaseClassWithoutParameterList = false ,
745+ allowColonForExtractorVarargs = false ,
746+ allowEnums = false ,
747+ allowImplicitByNameParameters = false ,
748+ allowInlineIdents = false ,
749+ allowInlineMods = false ,
750+ allowLiteralTypes = false ,
751+ allowMultilinePrograms = false ,
752+ allowOrTypes = false ,
753+ allowPatUnquotes = false ,
754+ allowSpliceUnderscores = false ,
755+ allowTermUnquotes = false ,
756+ allowToplevelTerms = false ,
757+ allowTrailingCommas = false ,
758+ allowTraitParameters = false ,
759+ allowTypeLambdas = false ,
760+ allowViewBounds = false ,
761+ allowXmlLiterals = false ,
762+ toplevelSeparator = " "
763+ ).withAllowEmptyInfixArgs(false ).withAllowSymbolLiterals(false ).withAllowProcedureSyntax(false )
764+ .withAllowDoWhile(false )
765+
766+ @ deprecated(" Use Dialect.empty (or any of the predefined dialects) and `.withXxx` methods" )
739767 def apply (
740768 @ deprecated(" allowAndTypes unneeded, infix types are supported" , " 4.5.1" )
741769 allowAndTypes : Boolean , // unused
0 commit comments