Skip to content

Commit

Permalink
Merge pull request #2346 from smarter/fix-scala3-features
Browse files Browse the repository at this point in the history
Enable xml and symbol literals in the Scala3 dialect
  • Loading branch information
tgodzik committed May 17, 2021
2 parents d3b22a3 + 7137b79 commit d6a864b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
5 changes: 1 addition & 4 deletions community-test/src/test/scala/CommunityDottySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ class CommunityDottySuite extends FunSuite {

final def dottyExclusionList = List()

final def munitExclusionList = List(
// xml literals are longer valid in Scala 3
"main/scala/docs/MUnitModifier.scala"
)
final def munitExclusionList = List()

final val ignoreParts = List(
"/tests/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ package object dialects {
.withAllowTraitParameters(true)
.withAllowTypeLambdas(true)
.withAllowViewBounds(false) // View bounds have been removed in Dotty
.withAllowXmlLiterals(false) // Scala 3: parser doesn't support xml
.withAllowGivenUsing(true)
.withAllowExtensionMethods(true)
.withAllowOpenClass(true)
Expand All @@ -147,7 +146,6 @@ package object dialects {
.withAllowMatchAsOperator(true)
.withAllowTypeMatch(true)
.withAllowInfixMods(true)
.withAllowSymbolLiterals(false)
.withAllowDependentFunctionTypes(true)
.withAllowAllTypedPatterns(true)
.withAllowAsForImportRename(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class MacroSuite extends BaseDottySuite {
* '{ ... } OR 'ident - QuotedMacroExpr
* '[ ... ] - QuotedMacroType
* ${ ... } OR $ident - SplicedMacroExpr
* symbols 'ident are not supported in dotty
*/
test("parse-single-quote-character") {
runTestAssert[Stat]("val a = 'c'")(
Expand Down Expand Up @@ -90,7 +89,13 @@ class MacroSuite extends BaseDottySuite {
)
)
val layoutMatchSimple = "x match {\n case 'c => 1\n}"
runTestError[Stat]("x match { case 'c => 1 }", "Symbol literals are no longer allowed")
runTestAssert[Stat]("x match { case 'c => 1 }", assertLayout = Some(layoutMatchSimple))(
Term.Match(
tname("x"),
List(Case(Lit.Symbol('c), None, Lit.Int(1))),
Nil
)
)
val layoutMatchComplex = "x match {\n case '{ a } => 1\n}"
runTestAssert[Stat]("x match { case '{ a } => 1 }", assertLayout = Some(layoutMatchComplex))(
Term.Match(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class MinorDottySuite extends BaseDottySuite {
}

test("xml-literals") {
intercept[TokenizeException] { term("<foo>{bar}</foo>")(dialects.Dotty) }
term("<foo>{bar}</foo>")(dialects.Dotty)
}

test("opaque-type-alias") {
Expand Down

0 comments on commit d6a864b

Please sign in to comment.