Skip to content

Commit 025f321

Browse files
Add comment in parser and use raw string literals in tests
Co-authored-by: CyrusNajmabadi <[email protected]>
1 parent 90220cc commit 025f321

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

src/Compilers/CSharp/Portable/Parser/LanguageParser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10513,6 +10513,9 @@ private void ParseDeclarationModifiers(SyntaxListBuilder list, bool isUsingDecla
1051310513
{
1051410514
mod = this.AddError(mod, ErrorCode.ERR_BadMemberFlag, mod.Text);
1051510515
}
10516+
// Note: Duplicate modifiers are not reported here during parsing.
10517+
// They will be reported during binding (see Binder_Statements.BindDeclarationStatementParts
10518+
// and ModifierUtils.ToDeclarationModifiers).
1051610519

1051710520
list.Add(mod);
1051810521
}

src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalErrorTests.cs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -442,27 +442,29 @@ public void DuplicateModifiers_NotReportedDuringParsing()
442442
{
443443
// Duplicate modifiers for local declarations and local functions should not produce
444444
// parsing errors. They will be reported during binding.
445-
var localDeclaration = @"
446-
class C
447-
{
448-
void M()
449-
{
450-
const const int a = 0;
451-
}
452-
}";
445+
var localDeclaration = """
446+
class C
447+
{
448+
void M()
449+
{
450+
const const int a = 0;
451+
}
452+
}
453+
""";
453454
ParserErrorMessageTests.ParseAndValidate(localDeclaration);
454455

455-
var localFunction = @"
456-
class C
457-
{
458-
void M()
459-
{
460-
static static void F() {}
461-
}
462-
}";
456+
var localFunction = """
457+
class C
458+
{
459+
void M()
460+
{
461+
static static void F() {}
462+
}
463+
}
464+
""";
463465
ParserErrorMessageTests.ParseAndValidate(localFunction);
464466

465-
var typeDeclaration = @"public public class C {}";
467+
var typeDeclaration = """public public class C {}""";
466468
ParserErrorMessageTests.ParseAndValidate(typeDeclaration);
467469
}
468470

0 commit comments

Comments
 (0)