swift
4668824a - [Macros] Fix an issue where the constraint system skipped local declarations

Commit
2 years ago
[Macros] Fix an issue where the constraint system skipped local declarations inside closures while type checking a macro expansion. PreCheckExpr, ConstraintGenerator, and other walkers do not walk into macro expansions. However, the implementation of this macro walking behavior in ASTWalker would skip any declaration that appears inside any macro expansion buffer. This is incorrect for cases where the parent is in the same macro expansion buffer, because the local declaration is not inside a new macro expansion. This caused bogus errors when type checking expanded macro expressions containing closures with local declarations, because pre-check and constraint generation mistakenly skipped local pattern bindings. (cherry picked from commit 265c8a47d97256457205f6fd90e5b801b4c924f2)
Author
Committer
Parents
  • include/swift/AST
    • File
      Decl.h
  • lib
    • AST
      • File
        ASTWalker.cpp
      • File
        Decl.cpp
    • IDE
      • File
        SourceEntityWalker.cpp
  • test/Macros
    • Inputs
      • File
        syntax_macro_definitions.swift
    • File
      macro_expand_closure.swift