@@ -531,7 +531,7 @@ final class LexicalContextTests: XCTestCase {
531531 struct S {
532532 let arg: C
533533 var contextDescription: String {
534- try await #lexicalContextDescription
534+ unsafe try await #lexicalContextDescription
535535 }
536536 }
537537 return S(arg: c)
@@ -542,9 +542,10 @@ final class LexicalContextTests: XCTestCase {
542542 struct S {
543543 let arg: C
544544 var contextDescription: String {
545- try await """
545+ unsafe try await """
546546 await _
547547 try _
548+ unsafe _
548549 contextDescription: String
549550 struct S {}
550551 { c in
@@ -553,7 +554,7 @@ final class LexicalContextTests: XCTestCase {
553554 struct S {
554555 let arg: C
555556 var contextDescription: String {
556- try await #lexicalContextDescription
557+ unsafe try await #lexicalContextDescription
557558 }
558559 }
559560 return S(arg: c)
@@ -568,83 +569,93 @@ final class LexicalContextTests: XCTestCase {
568569 )
569570 }
570571
571- func testTryAwaitInSequenceLexicalContext ( ) {
572+ func testEffectMarkersInSequenceLexicalContext ( ) {
572573 // Valid cases.
573574 assertMacroExpansion (
574- " try await #lexicalContextDescription + #lexicalContextDescription " ,
575+ " unsafe try await #lexicalContextDescription + #lexicalContextDescription" ,
575576 expandedSource: #"""
576- try await """
577+ unsafe try await """
577578 await _
578579 try _
580+ unsafe _
579581 """ + """
580582 await _
581583 try _
584+ unsafe _
582585 """
583586 """# ,
584587 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
585588 )
586589 assertMacroExpansion (
587- " try await 0 + 1 + foo(#lexicalContextDescription) + 2 " ,
590+ " try unsafe await 0 + 1 + foo(#lexicalContextDescription) + 2 " ,
588591 expandedSource: #"""
589- try await 0 + 1 + foo("""
592+ try unsafe await 0 + 1 + foo("""
590593 await _
594+ unsafe _
591595 try _
592596 """) + 2
593597 """# ,
594598 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
595599 )
596600 assertMacroExpansion (
597- " x = try await 0 + 1 + foo(#lexicalContextDescription) + 2 " ,
601+ " x = try await unsafe 0 + 1 + foo(#lexicalContextDescription) + 2 " ,
598602 expandedSource: #"""
599- x = try await 0 + 1 + foo("""
603+ x = try await unsafe 0 + 1 + foo("""
604+ unsafe _
600605 await _
601606 try _
602607 """) + 2
603608 """# ,
604609 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
605610 )
606- // `try await` in the 'then' branch doesn't cover condition or else.
611+ // `unsafe try await` in the 'then' branch doesn't cover condition or else.
607612 assertMacroExpansion (
608- " #lexicalContextDescription ? try await #lexicalContextDescription : #lexicalContextDescription " ,
613+ " #lexicalContextDescription ? unsafe try await #lexicalContextDescription : #lexicalContextDescription " ,
609614 expandedSource: #"""
610615 """
611- """ ? try await """
616+ """ ? unsafe try await """
612617 await _
613618 try _
619+ unsafe _
614620 """ : """
615621 """
616622 """# ,
617623 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
618624 )
619625 // Same for else.
620626 assertMacroExpansion (
621- " #lexicalContextDescription ? #lexicalContextDescription : try await #lexicalContextDescription " ,
627+ " #lexicalContextDescription ? #lexicalContextDescription : unsafe try await #lexicalContextDescription " ,
622628 expandedSource: #"""
623629 """
624630 """ ? """
625- """ : try await """
631+ """ : unsafe try await """
626632 await _
627633 try _
634+ unsafe _
628635 """
629636 """# ,
630637 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
631638 )
632- // 'try await' in the condition here covers the entire expression
639+ // 'unsafe try await' in the condition here covers the entire expression
633640 assertMacroExpansion (
634- " try await #lexicalContextDescription ? #lexicalContextDescription : #lexicalContextDescription ~~ #lexicalContextDescription " ,
641+ " unsafe try await #lexicalContextDescription ? #lexicalContextDescription : #lexicalContextDescription ~~ #lexicalContextDescription" ,
635642 expandedSource: #"""
636- try await """
643+ unsafe try await """
637644 await _
638645 try _
646+ unsafe _
639647 """ ? """
640648 await _
641649 try _
650+ unsafe _
642651 """ : """
643652 await _
644653 try _
654+ unsafe _
645655 """ ~~ """
646656 await _
647657 try _
658+ unsafe _
648659 """
649660 """# ,
650661 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
@@ -656,73 +667,80 @@ final class LexicalContextTests: XCTestCase {
656667 await _
657668 try! _
658669 try _
670+ unsafe _
659671 """
660672 """# ,
661673 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
662674 )
663675
664676 // Invalid cases
665677 assertMacroExpansion (
666- " 0 + try await #lexicalContextDescription " ,
678+ " 0 + unsafe try await #lexicalContextDescription " ,
667679 expandedSource: #"""
668- 0 + try await """
680+ 0 + unsafe try await """
669681 await _
670682 try _
683+ unsafe _
671684 """
672685 """# ,
673686 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
674687 )
675- // The ' try await' may not actually cover ' lexicalContextDescription' here,
676- // but this will be rejected by the compiler.
688+ // The `unsafe try await` may not actually cover ` lexicalContextDescription`
689+ // here, but this will be rejected by the compiler.
677690 assertMacroExpansion (
678- " 0 + try await 1 ^ #lexicalContextDescription " ,
691+ " 0 + unsafe try await 1 ^ #lexicalContextDescription " ,
679692 expandedSource: #"""
680- 0 + try await 1 ^ """
693+ 0 + unsafe try await 1 ^ """
681694 await _
682695 try _
696+ unsafe _
683697 """
684698 """# ,
685699 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
686700 )
687701 // Invalid if '^' has a lower precedence than '='.
688702 assertMacroExpansion (
689- " x = try await 0 ^ #lexicalContextDescription " ,
703+ " x = unsafe try await 0 ^ #lexicalContextDescription " ,
690704 expandedSource: #"""
691- x = try await 0 ^ """
705+ x = unsafe try await 0 ^ """
692706 await _
693707 try _
708+ unsafe _
694709 """
695710 """# ,
696711 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
697712 )
698713 // Unassignable
699714 assertMacroExpansion (
700- " #lexicalContextDescription = try await 0 + 1 " ,
715+ " #lexicalContextDescription = unsafe try await 0 + 1 " ,
701716 expandedSource: #"""
702717 """
703- """ = try await 0 + 1
718+ """ = unsafe try await 0 + 1
704719 """# ,
705720 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
706721 )
707722 assertMacroExpansion (
708- " try await #lexicalContextDescription = 0 + #lexicalContextDescription " ,
723+ " unsafe try await #lexicalContextDescription = 0 + #lexicalContextDescription" ,
709724 expandedSource: #"""
710- try await """
725+ unsafe try await """
711726 await _
712727 try _
728+ unsafe _
713729 """ = 0 + """
714730 await _
715731 try _
732+ unsafe _
716733 """
717734 """# ,
718735 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
719736 )
720737 assertMacroExpansion (
721- " try await foo() ? 0 : 1 = #lexicalContextDescription " ,
738+ " unsafe try await foo() ? 0 : 1 = #lexicalContextDescription" ,
722739 expandedSource: #"""
723- try await foo() ? 0 : 1 = """
740+ unsafe try await foo() ? 0 : 1 = """
724741 await _
725742 try _
743+ unsafe _
726744 """
727745 """# ,
728746 macros: [ " lexicalContextDescription " : LexicalContextDescriptionMacro . self]
0 commit comments