-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
accessor macro expansion doesn't remove initializer from stored property #2310
Comments
This error still exists on |
I am now tackling this problem. I don't know how long it will take me to find a solution though, since I need to get into the code base first. I appreciate any help here. However, if I imagine it correctly, removing a node from the AST should not be too complicated. Let's hope I'm not wrong. |
During my research I came across two interesting facts:
Together this leads me to the conclusion, that compiler is removing the initial value after all, only at a later point. On the other hand, this seems very odd, as |
When you say "actual expanded syntax", what are you using to see that expanded syntax? |
@DougGregor In my unit tests using |
This error still exists on |
Transferred over to swift-syntax - the issue here is solely in MacroSystem, which |
Tracked in Apple’s issue tracker as rdar://117442713 |
SE-0389 specifies that a macro returning either a getter or setter should remove the initializer, if one exists. Resolves rdar://117442713 (swiftlang#2310)
SE-0389 specifies that a macro returning either a getter or setter should remove the initializer, if one exists. Resolves rdar://117442713 (swiftlang#2310)
SE-0389 specifies that a macro returning either a getter or setter should remove the initializer, if one exists. Resolves rdar://117442713 (swiftlang#2310)
SE-0389 specifies that a macro returning either a getter or setter should remove the initializer, if one exists. Resolves rdar://117442713 (swiftlang#2310) (cherry picked from commit b3a3f1f)
SE-0389 specifies that a macro returning either a getter or setter should remove the initializer, if one exists. Resolves rdar://117442713 (swiftlang#2310) (cherry picked from commit b3a3f1f)
SE-0389 specifies that a macro returning either a getter or setter should remove the initializer, if one exists. Resolves rdar://117442713 (swiftlang#2310) (cherry picked from commit b3a3f1f)
commit 911284b3c63c1a9dd5ee47a54aa7bec84cc4cd24 Merge: 4265ac0e 28d9403e Author: Alex Hoppen <[email protected]> Date: Mon Jan 22 15:10:59 2024 -0800 Merge pull request #2429 from ahoppen/ahoppen/implementation-only Remove `@_implementationOnly` annotations commit 28d9403e48633ce3a13feec888bdb7076820aee9 Author: Alex Hoppen <[email protected]> Date: Sat Jan 20 15:07:50 2024 -0800 Remove `@_implementationOnly` annotations These annotations produce warnings when compiling swift-syntax without library evolution using Swift ≥5.10. Replace them by `private import` when compiling using Swift ≥5.11. Also mark the import of XCTest from `SwiftSyntaxMacrosTestSupport` as `private`, fixing rdar://119517162. rdar://119517162 commit 4265ac0ef01f061d251dc76aa1c82909ac43f44e Merge: 0f50f932 816eaefd Author: Ben Barham <[email protected]> Date: Fri Jan 19 16:05:51 2024 -0800 Merge pull request #2415 from bnbarham/qualify-extensions MacroSystem should qualify nested types when expanding extension macros commit 0f50f9326eef4b80954f993eb0e4d87d96edcda3 Merge: c70d1aad 1ebf4ec7 Author: Michael Gottesman <[email protected]> Date: Fri Jan 19 11:10:56 2024 -0800 Merge pull request #2410 from gottesmm/transferring [region-isolation] Add support for parsing transferring. commit c70d1aad7cc1d15a7b4271725547415be8a6b6c0 Merge: 4e7d61e5 a331a746 Author: Kim de Vos <[email protected]> Date: Fri Jan 19 15:59:48 2024 +0100 Merge pull request #2320 from kimdv/kimdv/2307-macrosystem-should-add-newline-at-the-end-of-added-members-for-an-empty-type Fix missing newline in member macro commit a331a746ed5eccd20dfda54bc66f43e22ec1b467 Author: Kim de Vos <[email protected]> Date: Thu Dec 7 08:45:32 2023 +0100 Fix newline closing brace and opening brace for expanded macros commit d09756b0bfddaabc6726a0f5e4dbf0b8ff8139de Author: Kim de Vos <[email protected]> Date: Tue Nov 28 20:45:34 2023 +0100 Fix error for trailing newline before end-of-file commit 4e7d61e5d89b7194cbe38ee078980bc579a57ac5 Merge: 35e0bc11 498d3115 Author: Alex Hoppen <[email protected]> Date: Wed Jan 17 18:48:11 2024 -0800 Merge pull request #2428 from ahoppen/ahoppen/indentation-newline-at-end-of-scope Fix indentation issue if trailing trivia contains a newline at the end of an indentation scope commit 498d3115ebc6101ac2dc66c042ebca13dee30948 Author: Alex Hoppen <[email protected]> Date: Fri Jan 12 17:04:03 2024 -0800 Fix indentation issue if trailing trivia contains a newline at the end of an indentation scope We were always adding indentation to the trailing trivia of a token. This could cause issues if the token at the end of an indentation scope (in most cases a `}` token) contained a trailing newline. In that case we would add indentation after that final newline based on the indentation scope of `}`, which effectively indented the next token to the indentation scope inside the `}` and thus indenting it one level to far. To fix this, don’t add indentation for trailing newlines of tokens. Instead, add the indentation as the leading trivia of the next token, which will pick up the correct indentation scope. commit 35e0bc1116b551faf22b867b9dcb6077f6a5d7ac Merge: 4dcc4ac1 ef6c604f Author: Alex Hoppen <[email protected]> Date: Tue Jan 16 16:47:43 2024 -0800 Merge pull request #2427 from ahoppen/ahoppen/infer-toolchain Automatically find toolchain from `swift-syntax-dev-utils` using `xcrun` on macOS commit ef6c604fa52314ff123eedb4bffc1c2d9c9485f9 Author: Alex Hoppen <[email protected]> Date: Fri Jan 12 15:33:08 2024 -0800 Automatically find toolchain from `swift-syntax-dev-utils` using `xcrun` on macOS commit 4dcc4ac199c2b31f24a3b1cf92b58852dd6e919f Merge: a7fa220f 38bfc61a Author: Alex Hoppen <[email protected]> Date: Fri Jan 12 13:28:53 2024 -0800 Merge pull request #2426 from pinkjuice66/parser-correct-utf8validation [Parser] Correct the start byte range for UTF8 characters. commit 38bfc61adff82abaf067d7f77842e01ffd6738a8 Author: pinkjuice66 <[email protected]> Date: Wed Jan 10 21:13:28 2024 +0900 [SwiftParser] Add a test case for the edge continuation byte commit 9b2f29fd90eb88bddeb6359b6be95299b46de229 Author: pinkjuice66 <[email protected]> Date: Wed Jan 10 20:58:53 2024 +0900 [SwiftParser] Correct the range for the start byte of a UTF8 character commit a7fa220fee8f7513e226ced35dd0ae4377d6293d Merge: 92159bc5 616f2d08 Author: Alex Hoppen <[email protected]> Date: Wed Jan 10 16:12:35 2024 -0800 Merge pull request #2424 from ahoppen/ahoppen/skip-newlines-for-weak-bracket-close Skip newlines for `weakBracketClose` precedence level commit 92159bc5f457e968ab8bf58fa116b98d8437bd8e Merge: f2ef161a 9354c7cc Author: Alex Hoppen <[email protected]> Date: Wed Jan 10 16:12:28 2024 -0800 Merge pull request #2408 from ahoppen/ahoppen/macro-article Add an article version of my WWDC talk on how to write macros commit f2ef161a8d3b22d92708a5764b450f75424dfeca Merge: 23e4c010 4354b338 Author: Alex Hoppen <[email protected]> Date: Wed Jan 10 15:28:05 2024 -0800 Merge pull request #2422 from ahoppen/ahoppen/fixme-cleanup Removes TODOs and FIXMEs that are no longer applicable commit 23e4c010adb8c834f1e90341d55bb8f3f0646496 Merge: 714be467 4be26b0b Author: Alex Hoppen <[email protected]> Date: Wed Jan 10 15:27:55 2024 -0800 Merge pull request #2423 from ahoppen/ahoppen/available-in-specialize Remove ability to parse `available` in `@_specialize` commit 714be467f28398ac0c8d78a0defb531e9b2d40c1 Merge: 7ba76876 a93a3a23 Author: Pavel Yaskevich <[email protected]> Date: Wed Jan 10 14:05:12 2024 -0800 Merge pull request #2419 from xedin/preconcurrency-conformances Add support for `@preconcurrency` type attribute commit a93a3a23acdbc203b1fef621910c1464bf0747c1 Author: Pavel Yaskevich <[email protected]> Date: Mon Jan 8 14:54:20 2024 -0800 Add support for `@preconcurrency` type attribute Part of the `@preconcurrency` conformances feature. Swift Forums discussion - https://forums.swift.org/t/pitch-dynamic-actor-isolation-enforcement/68354 commit 7ba768761dc3d49b580f5e68df92314e88291031 Merge: 80182245 a119a276 Author: Alex Hoppen <[email protected]> Date: Wed Jan 10 11:00:51 2024 -0800 Merge pull request #1635 from ahoppen/ahoppen/verify-spi-yml Verify that .spi.yml is up-to-date in swift-syntax-dev-utils commit 1ebf4ec713451e3d505b6cfc4f1e9d4a30517ce1 Author: Michael Gottesman <[email protected]> Date: Sat Dec 23 22:59:21 2023 -0800 [region-isolation] Generated code for transferring arguments. commit cde223adab15cce389136dca6125a3688807823c Author: Michael Gottesman <[email protected]> Date: Sat Dec 23 22:54:56 2023 -0800 [region-isolation] Add support for parsing arguments with transferring convention. commit 616f2d08f73aed79931ccba97abf19b588c85632 Author: Alex Hoppen <[email protected]> Date: Sun Jan 7 18:58:06 2024 -0800 Skip newlines for `weakBracketClose` precedence level This slightly improves recovery. commit 4be26b0b99cca5d0ca30751669b128dd4cdc75b1 Author: Alex Hoppen <[email protected]> Date: Sun Jan 7 17:46:49 2024 -0800 Remove ability to parse `available` in `@_specialize` The `available` argument to `@_specialize` is only supported in SIL, which SwiftSyntax doesn’t parse. commit 4354b3382341fb422637cd28a7b57733c2d016cd Author: Alex Hoppen <[email protected]> Date: Sun Jan 7 17:43:16 2024 -0800 Removes TODOs and FIXMEs that are no longer applicable commit 80182245e31944415e2bb5e705bc1f693995f0ae Merge: 44f69680 31be2989 Author: Alex Hoppen <[email protected]> Date: Tue Jan 9 13:19:21 2024 -0800 Merge pull request #2096 from ahoppen/ahoppen/verify-documentation Add subcommand to swift-syntax-dev-utils to verify that documentation builds without errors or warnings commit 31be2989ae212624ee921a8b1759c382577f97ae Author: Alex Hoppen <[email protected]> Date: Wed Aug 23 15:09:42 2023 -0700 Add subcommand to swift-syntax-dev-utils to verify that documentation builds without errors or warnings We regularly introduce invalid references into our documentation. Build the docc archive using `-warnings-as-errors` to catch these invalid references in CI. rdar://110990240 commit a119a27634b0c509694fad6a195ca692e9d9d72e Author: Alex Hoppen <[email protected]> Date: Mon Jan 8 16:34:41 2024 -0800 Verify that .spi.yml is up-to-date in swift-syntax-dev-utils .spi.yml at one point got out of sync of the libraries we added to Package.swift. Add a verification script to make sure that they match. The idea is that for every library that every library that is exposed by SwiftSyntax should be documentated on swiftpackageindex.com. rdar://108901461 commit 9354c7ccc534a015af8140de848f54a7d3928632 Author: Alex Hoppen <[email protected]> Date: Fri Dec 22 21:26:11 2023 -0800 Add an article version of my WWDC talk on how to write macros commit 816eaefd6bbff91e4d8417e67b049cccf4ef0003 Author: Ben Barham <[email protected]> Date: Wed Jan 3 12:50:14 2024 -0800 MacroSystem should qualify nested types when expanding extension macros Resolves rdar://119850970. commit 44f69680412c7802a7512f4e34f143c210b4dee2 Merge: 7131e3b3 e5985e1a Author: Doug Gregor <[email protected]> Date: Sat Jan 6 00:30:13 2024 -0800 Merge pull request #2418 from DougGregor/effect-specifier-lookahead-fix Fix lookahead for effects specifiers in function types commit e5985e1a1b82bbb5c4540ac313967bf4a64cb977 Author: Doug Gregor <[email protected]> Date: Fri Jan 5 21:56:58 2024 -0800 Fix lookahead for effects specifiers in function types commit 7131e3b316875973abd7a0f45478d710f680143d Merge: e14af92c 273178fb Author: Doug Gregor <[email protected]> Date: Thu Jan 4 16:11:18 2024 -0800 Merge pull request #2412 from DougGregor/se-0413-typed-throws-accepted [SE-0413] Typed throws: enable by default commit 273178fb2d85a3eddff97003239408778939abd2 Author: Doug Gregor <[email protected]> Date: Tue Jan 2 16:18:38 2024 -0800 SE-0414 "Typed throws" has been accepted Always parse typed throws commit 7f5f39d1ffa356c3013b02103d298f6226de2b73 Author: Doug Gregor <[email protected]> Date: Tue Jan 2 11:00:25 2024 -0800 Regenerate syntax nodes now that typed throws is not experimental commit dc8559bd2f1237dd595d8c86731454c9870b591d Author: Doug Gregor <[email protected]> Date: Tue Jan 2 10:56:22 2024 -0800 SE-0414 "Typed throws" has been accepted Drop the `typedThrows` experimental feature. commit e14af92c1f9986d64259efa72ad9a896e4b88714 Merge: af5df272 766a260d Author: Evan Wilde <[email protected]> Date: Wed Jan 3 13:13:53 2024 -0800 Merge pull request #2413 from etcwilde/ewilde/emit-private-interface Emit private interfaces on all swift libraries commit af5df2729e7b7d4e12781bc1ca442638748a121b Merge: c52ab77d 7760e6e4 Author: Hamish Knight <[email protected]> Date: Wed Jan 3 20:05:28 2024 +0000 Merge pull request #2409 from hamishknight/add-missing-dep Add missing dependency for SwiftSyntaxMacroExpansion commit 7760e6e474645ce25ed93288b67e1dc74eec5cd1 Author: Hamish Knight <[email protected]> Date: Wed Jan 3 12:48:07 2024 +0000 Add missing dependency for SwiftSyntaxMacroExpansion SwiftSyntaxMacroExpansion imports SwiftOperators, add it as a CMake link dependency. Also add the transitive dependencies while here. commit c52ab77db82b8f5c68c50d2eee858d223d59c900 Merge: 184930ad 5111dab9 Author: Michael Gottesman <[email protected]> Date: Tue Jan 2 18:51:41 2024 -0800 Merge pull request #2411 from gottesmm/add-feature-flag [region-isolation] Add feature flag for TransferringArgsAndResults commit 766a260dfd78197db0a4692bb8d7537e8d9d7d3b Author: Evan Wilde <[email protected]> Date: Tue Jan 2 16:58:09 2024 -0800 Emit private interfaces on all swift libraries Swift-driver PR [1043](https://github.com/apple/swift-driver/pull/1043) updated the new driver to always emit private swiftinterface files. This was not carried back to the old driver, so attempting to bootstrap the toolchain on a system that does not have the new driver fails to install because we try to install the private swiftinterface on all Swift targets. commit 5111dab99b9499e6ed8eaadb7168aa2313568b2b Author: Michael Gottesman <[email protected]> Date: Tue Jan 2 13:46:58 2024 -0800 Generated syntax for TransferringArgsAndResults. commit 12cbc30f9bd26cd4b63e1bfedaee525999527390 Author: Michael Gottesman <[email protected]> Date: Tue Jan 2 13:37:06 2024 -0800 [region-isolation] Add an experimental feature flag for transferringArgsAndResults. Just getting ahead of the main work. commit 184930ad29dbfa924e9568f49daee8ad0f376223 Merge: 982dea84 d9832e81 Author: Andrew Trick <[email protected]> Date: Thu Dec 14 16:00:56 2023 -0800 Merge pull request #2405 from apple/rename-nonescapable Rename NonesapableTypes feature commit d9832e81fae03a6f78c125f925977bba2d0e794e Author: Andrew Trick <[email protected]> Date: Wed Dec 13 18:40:59 2023 -0800 Rename NonesapableTypes feature Follow the feature flag convention for capitalization and be consistent with the related NoncopyableGenerics feature. Corresponding swift commit 2a7c21f33be88ebb0329a9f1d7ee9a1b36c7e8ff commit 982dea845e436c766e736210a5589f4c9858e61e Merge: e647880e c0de706c Author: Sophia Poirier <[email protected]> Date: Thu Dec 14 08:29:38 2023 -0800 Merge pull request #2404 from sophiapoirier/nonisolated-unsafe-experimental-feature-flag-removal Revert "guard nonisolated(unsafe) by experimental feature" commit e647880e4a4d14c0ee0820661b14c6f740426424 Merge: 3c45445f 46fa0b36 Author: Alex Hoppen <[email protected]> Date: Thu Dec 14 08:09:01 2023 -0800 Merge pull request #2401 from ahoppen/ahoppen/fixme-namematcher Address remaining `FIXME`s for the new `NameMatcher` commit c0de706ccb60cb93d00b79591368d57f0e1d9a9c Author: Sophia Poirier <[email protected]> Date: Wed Dec 13 14:49:19 2023 -0800 Revert "guard nonisolated(unsafe) by experimental feature" This reverts commit 0361e88b10b63030259b6d5c47d58f91c6f9a271. commit 46fa0b3616f50366ac44123b4ec1bb07928c4ad5 Author: Alex Hoppen <[email protected]> Date: Mon Dec 11 16:40:05 2023 -0800 Address remaining `FIXME`s for the new `NameMatcher` rdar://118996561 commit 3c45445f49922a740f13f777fa459aa5f92d559f Merge: c4529c12 82c7c494 Author: Rintaro Ishizaki <[email protected]> Date: Tue Dec 12 17:08:55 2023 -0800 Merge pull request #2395 from rintaro/wildcardpattern-typeannotation commit 82c7c494579ec4a7ab4cafcfed4a3ffc8f7eb59a Author: Rintaro Ishizaki <[email protected]> Date: Mon Dec 11 13:42:55 2023 -0800 Add a release notes for `WildcardPatternSyntax.typeAnnotation` commit 3ad670b56f20a3a5e3bdd8731e07528f92aad6d7 Author: Rintaro Ishizaki <[email protected]> Date: Fri Dec 8 19:11:41 2023 -0800 Remove `WildcardPattern.typeAnnotation` Type annotation has never been a part of `wildcard-pattern`. commit c4529c12021dd2cecb0722e9e6cdd7c9558b8634 Merge: 89831cea dd7cb9ad Author: Alex Hoppen <[email protected]> Date: Mon Dec 11 20:08:24 2023 -0800 Merge pull request #2398 from ahoppen/ahoppen/no-swiftch-expr Don’t use switch expressions commit 89831cea0f5dcc12ae0fc2b86ce83319bd3082db Merge: 7143774a 46334f0a Author: Alex Hoppen <[email protected]> Date: Mon Dec 11 15:36:40 2023 -0800 Merge pull request #2399 from ahoppen/ahoppen/fix-warning Fix a deprecation warning in DeclarationMacroTests commit 46334f0a1ffebc416d4f01fc7067e98219787a01 Author: Alex Hoppen <[email protected]> Date: Mon Dec 11 12:12:45 2023 -0800 Fix a deprecation warning in DeclarationMacroTests commit dd7cb9ad1a5a42e83670764c3cec741489f148af Author: Alex Hoppen <[email protected]> Date: Mon Dec 11 12:04:24 2023 -0800 Don’t use switch expressions I forgot that we need to support Swift 5.8 when I introduced the switch expression. Write the test without relying on Swift 5.9 features. commit 7143774a194d55caa14b65904f3e5d887d6f4115 Merge: 8f1fe05a 5b3eb0b7 Author: Alex Hoppen <[email protected]> Date: Mon Dec 11 10:00:45 2023 -0800 Merge pull request #2396 from tayloraswift/patch-1 enable swift source highlighting for the two code blocks in `Working with SwiftSyntax.md` commit 8f1fe05af88beca5c02de44e0e60538921f3b5b9 Merge: 2511e256 77c0b807 Author: Saleem Abdulrasool <[email protected]> Date: Sun Dec 10 18:13:46 2023 -0800 Merge pull request #2397 from compnerd/cleanup build: clean up `Package.swift` slightly commit 77c0b8077546e5048993c1461ea1cc3c98beaeaf Author: Saleem Abdulrasool <[email protected]> Date: Sun Dec 10 15:37:57 2023 -0800 build: clean up `Package.swift` slightly Now that macros are enabled on all the platforms we currently support (Windows, Linux, Apple), the optional addition of the macro targets was removed. Clean up the structure of the file as the initial changes were done quickly to enable testing on all platforms. commit 5b3eb0b758ff3e2e6631f8a8f59ec068850d10d0 Author: taylorswift <[email protected]> Date: Sat Dec 9 15:27:30 2023 -0600 enable swift source highlighting for the two code blocks in this article commit 2511e25605a663bd965efff06762f05b1d05b2b4 Author: Dario Rexin <[email protected]> Date: Sat Dec 9 08:13:34 2023 -0800 Add _BridgeObject and _TrivialStride layouts (#2390) * Add _BridgeObject and _TrivialStride layouts Both layout kinds are useful for pre-specializations of commonly emitted generic function specializations. * Add tests * Code formatting commit ab497720a8f9dd62b6d47a3ac06c337dd9a75faf Merge: 201e0e37 0ed5a1c5 Author: Alex Hoppen <[email protected]> Date: Sat Dec 9 06:20:25 2023 -0800 Merge pull request #2394 from ahoppen/ahoppen/standardize-copyright-header commit 201e0e37aca793fcedc2a4e75bc2c549379d5138 Merge: c2475102 5b04406a Author: Alex Hoppen <[email protected]> Date: Fri Dec 8 21:14:31 2023 -0800 Merge pull request #2393 from ahoppen/ahoppen/throws-clause-review-comments Address review comments for API compatibility of `ThrowsClauseSyntax` commit 0ed5a1c5f2e99c64d968a0ffacbef648f9a6dec0 Author: Alex Hoppen <[email protected]> Date: Fri Dec 8 18:21:58 2023 -0800 Fix incorrect copyright headers commit 5b04406ac10865639cded6328e376d9311c061af Author: Alex Hoppen <[email protected]> Date: Fri Dec 8 17:04:13 2023 -0800 Address review comments for API compatibility of `ThrowsClauseSyntax` commit c247510243dbe59208421fb2671be5d75267eda5 Merge: ab4b2bd5 4446b03c Author: Doug Gregor <[email protected]> Date: Fri Dec 8 11:03:57 2023 -0800 Merge pull request #2392 from DougGregor/body-macro-comment-fix Fix comment on expandBodyMacro commit 4446b03c4d958a677aaad76535d7f1b0dc521991 Author: Doug Gregor <[email protected]> Date: Tue Dec 5 16:07:50 2023 -0800 Fix comment commit ab4b2bd54cd9120478b8bca055991ff29693389d Merge: 434503a4 c9ee77fb Author: Meghana Gupta <[email protected]> Date: Wed Dec 6 22:12:28 2023 -0800 Merge pull request #2386 from apple/resultDependsOn Add initial support for _resultDependsOn commit 434503a40f8d0eaa0e6b42863d813734905a8fbb Merge: dda97538 2fec3792 Author: Rintaro Ishizaki <[email protected]> Date: Wed Dec 6 19:41:35 2023 -0800 Merge pull request #2388 from rintaro/cmake-abi-name-shell [CMake] -Xfrontend paired arguments are unique by the pair commit dda975380061d2bc80cac12006fa9cf5fa90211d Merge: cc951025 70588491 Author: Rintaro Ishizaki <[email protected]> Date: Wed Dec 6 17:45:07 2023 -0800 Merge pull request #2387 from rintaro/cmake-color-diagnostics commit cc95102587dd5637a87097e02bec8665d704dd00 Merge: af5f3863 e52cc418 Author: Alex Hoppen <[email protected]> Date: Wed Dec 6 14:25:21 2023 -0800 Merge pull request #2375 from ahoppen/ahoppen/parameter-label-highlighting Add syntax highlighting for parameter labels commit af5f386390d1ea1eb306ee807fdcda4478bb7e1c Merge: 06b57f3e d4d7b081 Author: Rintaro Ishizaki <[email protected]> Date: Wed Dec 6 13:24:06 2023 -0800 Merge pull request #2385 from rintaro/rattokenkind-spi `TokenSyntax.rawTokenKind` to get raw token kind commit 2fec379295dd763c7e16664fc4b0e571466a7242 Author: Rintaro Ishizaki <[email protected]> Date: Wed Dec 6 10:35:02 2023 -0800 [CMake] -Xfrontend paired arguments are unique by the pair commit 70588491207ba70f516b09f45050e0107727790f Author: Rintaro Ishizaki <[email protected]> Date: Wed Dec 6 10:34:22 2023 -0800 [CMake] Color diagnostics commit c9ee77fb97ecd08165c84fdf543ccadf1261fcfb Author: Meghana Gupta <[email protected]> Date: Wed Dec 6 10:17:16 2023 -0800 Update Sources/SwiftParser/Patterns.swift Co-authored-by: Alex Hoppen <[email protected]> commit e52cc418de36be0d7e3ce20fd30f6ac479c510b9 Author: Alex Hoppen <[email protected]> Date: Wed Nov 29 10:05:27 2023 -0800 Add syntax highlighting for parameter labels commit d0817d9b0327ca02ecf72ee8e631e062de4dd373 Author: Meghana Gupta <[email protected]> Date: Mon Oct 16 10:13:17 2023 -0700 Add initial support for _resultDependsOn Add them under a new NonEscapableTypes experimental feature commit 06b57f3eab7ddf15ddf13d015e14d51739b4a433 Merge: 62d8f9f6 d4021a7d Author: Doug Gregor <[email protected]> Date: Tue Dec 5 21:46:56 2023 -0800 Merge pull request #2384 from DougGregor/function-body-macro-formatting Clean up formatting of function body macros commit d4d7b081baf2cfc52e1e0f1a4eee3516f86a50b4 Author: Rintaro Ishizaki <[email protected]> Date: Tue Dec 5 17:42:34 2023 -0800 TokenSyntax.rawTokenKind to get raw token kind `TokenSyntax.tokenKind` instantiate `TokenKind` with `Swift.String`. Getting `RawTokenKind` is useful for performance critical logic. commit d4021a7dd9413d9f4d60756d27418e8205668bd8 Author: Doug Gregor <[email protected]> Date: Tue Dec 5 13:32:08 2023 -0800 Clean up formatting of function body macros commit 62d8f9f6601e9e936514a132861757ff0c1145e9 Merge: 60791cd1 81d61ee9 Author: Rintaro Ishizaki <[email protected]> Date: Mon Dec 4 18:42:38 2023 -0800 Merge pull request #2383 from rintaro/syntaxtext-spi `TokenSyntax.rawText` to get raw token text as `SyntaxText` commit 60791cd123a3326f681d8a2831510a3b9c28066e Merge: 046a6030 8abecc44 Author: Alex Hoppen <[email protected]> Date: Mon Dec 4 14:05:45 2023 -0800 Merge pull request #2380 from SimplyDanny/braced-precedence-decl-group Let `PrecedenceGroupDeclSyntax` conform to `BracedSyntax` commit 81d61ee99132a4489918ec7ee9590fe1e4847582 Author: Rintaro Ishizaki <[email protected]> Date: Sun Dec 3 23:38:33 2023 -0800 TokenSyntax.rawText to get raw token text as SyntaxText Declare `SyntaxText` as a SPI. and expose `tokenView.rawText`. `SyntaxText` is a byte sequence conforms to `RandomAccessCollection` and has basic query methods e.g. '==', 'hasPrefix(_:)', 'contains(_:)'. It is useful for performance critical logic because it's faster than `TokenSytnax.text` which requies intantiating `TokenKind` often with `Swift.String`. commit 046a60308c5444f13e1a4cf6354a161207c38f47 Merge: 5cec9bdf 2d348b23 Author: Doug Gregor <[email protected]> Date: Sat Dec 2 14:12:57 2023 -0800 Merge pull request #2381 from DougGregor/do-throws commit 2d348b2380f4f780f08cb7e0ae1a49d75e86a050 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 13:02:34 2023 -0800 Parser support for `do..catch` blocks with typed throws commit b1d9affaf92b3c54aeb71b6a98c6ccdb6d29ca80 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 12:51:00 2023 -0800 Regenerate for throws clause on a do statement commit 56d7417e582a72a4813ee1401dfbdf12c53355a8 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 12:49:53 2023 -0800 Add a `throws` clause to `do..catch` statements commit 5cec9bdf25b6a0a33f2033eaf5239ce1fd8e680a Merge: 6e708c4f ebd8e2e2 Author: Doug Gregor <[email protected]> Date: Sat Dec 2 07:32:11 2023 -0800 Merge pull request #2379 from DougGregor/throws-clause Replace throwsSpecifier/thrownTypeClause with a unified throwsClause commit 8abecc44089a28fbfc1bf688aec4f934f015dbcd Author: Danny Mösch <[email protected]> Date: Sat Dec 2 01:46:56 2023 +0100 Let `PrecedenceGroupDeclSyntax` conform to `BracedSyntax` commit ebd8e2e2f6b06ba71bc502da45071d67a813fd2a Author: Doug Gregor <[email protected]> Date: Fri Dec 1 23:24:14 2023 -0800 Clean up parsing of effect specifiers a bit Teach `parseThrowsClause(after:)` to check for the `(` itself, so we have just the one place where we deal with the presence or absence of the thrown error type specification. commit b1767acdccc6cde5f67c001114eecd6d4a6f48b6 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 22:46:13 2023 -0800 Add compatibility inits for remaining effects nodes commit 67b81238d791cea4996477a79da08592dad69c8d Author: Doug Gregor <[email protected]> Date: Fri Dec 1 22:40:48 2023 -0800 Improve EffectSpecifiersSyntax.throwsSpecifier compatibility property commit 0be9c6209cc23e181073a4c819760f117dcd6da3 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 22:14:42 2023 -0800 Fix formatting commit d0a35c5c49636160883c749cdcf240893f894468 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 15:20:21 2023 -0800 Switch to throwsClause API for macro example commit 3fe699772de4383c52493e09c5a7591805795c76 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 15:19:04 2023 -0800 Improve compatibility shims for throws clause refactoring commit 7eaee714f18bf2c93ea8be418658d1768aafa71d Author: Doug Gregor <[email protected]> Date: Fri Dec 1 12:17:57 2023 -0800 Add pull request number to release note commit 73c1ce979ca515039f81d7cc01dc697bf41b16ab Author: Doug Gregor <[email protected]> Date: Fri Dec 1 12:16:07 2023 -0800 Reformat commit c0e763c38b3ba34d8a982502fd7bc7e91d8e7bed Author: Doug Gregor <[email protected]> Date: Fri Dec 1 12:08:37 2023 -0800 Add release note for the introduction of the throws clause commit 0e1dcddfa7a8fc3c5844dcfb3359ccbbfc588341 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 12:02:22 2023 -0800 Update parser and tests for throws clause changes commit d4134ac1d949ac224d2cbe3636989bd6660a6fb5 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 11:42:12 2023 -0800 Regenerate with the new ThrowsClauseSyntax commit b4155dbb55e678741ae51f5af1b2b4141d6c52e0 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 11:14:08 2023 -0800 Replace throwsSpecifier/thrownTypeClause with a unified throwsClause This better matches the proposal grammar better and keeps the `throws` (or `rethrows`) alongside the thrown error type. commit 6e708c4fa643057f41e3af7e6c0a2c405a487e56 Merge: 6f1dfc33 38c954e7 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 14:15:38 2023 -0800 Merge pull request #2378 from DougGregor/release-note-codeblocksyntax Add release note for CodeBlockSyntax becoming SyntaxParseable. commit 38c954e7a18466bf0283aac0d7d8dc17cae1cf85 Author: Doug Gregor <[email protected]> Date: Fri Dec 1 11:06:30 2023 -0800 Update Release Notes/511.md Co-authored-by: Ben Barham <[email protected]> commit 671eec1f1f879083e35848d01efda10c211a8dbe Author: Doug Gregor <[email protected]> Date: Fri Dec 1 10:48:46 2023 -0800 Add release note for CodeBlockSyntax becoming SyntaxParseable. commit 6f1dfc338d14774f16bf78e6c84100c936f341b2 Merge: 1ebf3b38 9517468c Author: Alex Hoppen <[email protected]> Date: Thu Nov 30 09:37:50 2023 -0800 Merge pull request #2360 from ahoppen/ahoppen/name-matcher-in-swift Implement `NameMatcher` in Swift commit 1ebf3b381dfdebc8e232ebf882cd9d033e7b8467 Merge: 873eee0a b63982a4 Author: Alex Hoppen <[email protected]> Date: Wed Nov 29 21:38:57 2023 -0800 Merge pull request #2376 from ahoppen/ahoppen/swift-syntax-dev-utils Add a bash script to simplify calling `swift-syntax-dev-utils` commit b63982a444afabc353b6fb8cf11fb7dc1c1d9672 Author: Alex Hoppen <[email protected]> Date: Wed Nov 29 15:48:02 2023 -0800 Add a bash script to simplify calling `swift-syntax-dev-utils` Calling `swift-syntax-dev-utils` has always been a little bit cumbersome. Add a `swift-syntax-dev-utils` script that expands to `swift run --package-path SwiftSyntaxDevUtils/` to make it simpler. rdar://118137372 Fixes #2341 commit 9517468c1b6a02a314d74277b299908ec3fb8fb9 Author: Alex Hoppen <[email protected]> Date: Wed Nov 15 18:10:44 2023 -0800 Rewrite `NameMatcher` in Swift commit 873eee0aac6bc41e5e676c4e4c75d9eb5413c528 Merge: d6470523 66f7215b Author: Alex Hoppen <[email protected]> Date: Wed Nov 29 14:17:30 2023 -0800 Merge pull request #2280 from compnerd/example-macros build: enable Macros examples on other platforms commit d64705232df46e90dd1a823e2c19241ebec7badb Author: Rauhul Varma <[email protected]> Date: Wed Nov 29 07:24:00 2023 -0800 Improve assertMacroExpansion highlight verification (#2213) Adds a new initializer to DiagnosticSpec which takes an optional array of highlights instead of a single optional highlight string. Updates existing initializer to map the string into an array of one. Updates assertMacroExpansion to check each highlight in the diagnostic spec against the actual produced diagnostic individually. Additionally changes the behavior to drop leading and trailing trivial when performing the highlight comparison to better match the Swift compiler's behavior. commit 5eab7e514273b752b4edcce9844a81ad1a4ea96f Merge: a082866d fed23572 Author: Alex Hoppen <[email protected]> Date: Tue Nov 28 19:58:44 2023 -0800 Merge pull request #2370 from ahoppen/ahoppen/sendable-no-args Never parse arguments of a `Sendable` attribute commit a082866d48e1b88071cb24ce0dd0417ffdc7e161 Merge: cf49214a b33ce9bc Author: Alex Hoppen <[email protected]> Date: Tue Nov 28 17:11:44 2023 -0800 Merge pull request #2369 from owlsnakes/patch-1 Fix typo in PeerMacros.swift commit fed235726ff807a1f379abca8668eee979daba94 Author: Alex Hoppen <[email protected]> Date: Tue Nov 28 15:26:54 2023 -0800 Never parse arguments of a `Sendable` attribute Fixes #2367 rdar://118608697 commit b33ce9bcbd5dabee475a0ed22f9d409bfac35ed3 Author: Estevan Hernandez <[email protected]> Date: Tue Nov 28 14:36:33 2023 -0600 Update PeerMacros.swift commit cf49214a2cd6bde6c32b00c71cb4b264114c1245 Merge: aac81f18 edf12c8d Author: Doug Gregor <[email protected]> Date: Tue Nov 28 09:43:33 2023 -0800 Merge pull request #1874 from DougGregor/function-body-macros [Macros] Implement function body macros commit aac81f18067d4f6c787339d13b901befc3133d66 Merge: 296e24d8 5cf467db Author: Alex Hoppen <[email protected]> Date: Mon Nov 27 14:24:39 2023 -0800 Merge pull request #2350 from Matejkob/refactor-dev-utils Refactor swift-syntax-dev-utils package commit 296e24d8967a9b462e1adc44fbe10c1492a45a2c Author: Rauhul Varma <[email protected]> Date: Mon Nov 27 12:55:00 2023 -0500 Update DeclGroupSyntax to refine DeclSyntaxProtocol (#2366) Updates the swift-syntax code generator to support traits refining a syntax base type. Uses this new code generator feature to change DeclGroupSyntax to refine DeclSyntaxProtocol. commit 0d3f3e3f1cf62f5de38191125c6099f9e4bc80ee Merge: 7c1c56c0 ed33fe61 Author: Alex Hoppen <[email protected]> Date: Sun Nov 26 20:51:13 2023 -0800 Merge pull request #2362 from KaitoMuraoka/fix/document-tutorial Tutorial updated to support Xcode15 commit 5cf467dbc89a9fbd5a08be3578e8afa5d8440e36 Author: Mateusz Bąk <[email protected]> Date: Fri Nov 10 16:50:38 2023 +0100 Remove public access modifier from process runner commit f672c280e56869a479e97268b34ecf3002f09f14 Author: Mateusz Bąk <[email protected]> Date: Fri Nov 10 16:50:01 2023 +0100 Remove unused code commit 8f6a53b106b58d81ab74272fb0087db16d482cf3 Author: Mateusz Bąk <[email protected]> Date: Fri Nov 10 16:41:20 2023 +0100 Refactor Command Execution Logic into Dedicated Executors This commit introduces a major overhaul of the command execution logic within the SwiftSyntaxDevUtils package. The primary aim is to decouple the command interface from the underlying business logic, thus enhancing code maintainability and enabling the execution of some commands from others. Key Changes: - Introduced the concept of 'executor', which now encapsulates the logic previously contained within specific commands like `Build`, `Format`, etc. - Command structs have been refactored to focus primarily on argument parsing, delegating execution to these new executors. - This refactoring adheres to the Single Responsibility Principle, ensuring a clear, singular focus for each class or struct. No new functionalities have been introduced, but these changes significantly improve the codebase's structure and clarity. This shift lays a solid foundation for more scalable and maintainable development in SwiftSyntaxDevUtils going forward. commit e2d108a79dc8b1f1e726274b0ab7107a061ca524 Author: Mateusz Bąk <[email protected]> Date: Fri Nov 10 16:17:55 2023 +0100 Simplify the `configuration` property's implementation across all commands commit ed33fe61ce777cb42739ebeab817743ad322acac Author: とんとんぼ <[email protected]> Date: Fri Nov 17 10:03:07 2023 +0900 Update Sources/SwiftSyntax/Documentation.docc/Tutorials/SwiftSyntax By Example.tutorial Co-authored-by: Alex Hoppen <[email protected]> commit edf12c8dbbf2c4dab8ab9dac5d23c1c2bf871707 Author: Doug Gregor <[email protected]> Date: Thu Nov 16 12:23:45 2023 -0800 Address code review comments commit 3856e2e533c014cad9c1b89f40d906a65c5499aa Merge: c7901eae 7c1c56c0 Author: KaitoMuraoka <[email protected]> Date: Fri Nov 17 01:02:42 2023 +0900 Merge branch 'main' into fix/document-tutorial commit c7901eae0360221818c04de08ba6dc32fdc93bd4 Author: KaitoMuraoka <[email protected]> Date: Fri Nov 17 00:56:32 2023 +0900 Add @Step to section 2 commit 7c1c56c0aa505c939b210b9f3b6797417107820a Merge: 4af9b164 576cbb6a Author: Doug Gregor <[email protected]> Date: Thu Nov 16 07:01:24 2023 -0800 Merge pull request #2361 from DougGregor/parseable-codeblocksyntax commit 7ac533605dca605c6e1ba1b68439188b6acd9e7d Author: KaitoMuraoka <[email protected]> Date: Thu Nov 16 23:06:07 2023 +0900 fix: Formatter.step was adapted to Xcode15. commit 4af9b1642f5c014df31b582e8f7080d2bb86e0bb Merge: d5ab1c7e ed7e66dc Author: Doug Gregor <[email protected]> Date: Wed Nov 15 22:24:01 2023 -0800 Merge pull request #2359 from DougGregor/with-optional-code-block Add WithOptionalCodeBlock trait and adopt it where there's a body commit d5ab1c7ece7a40e9fb09ddeda18b4da506e1bcbc Merge: 3914c0b4 f567587a Author: Alex Hoppen <[email protected]> Date: Wed Nov 15 21:39:16 2023 -0800 Merge pull request #2329 from Matejkob/update-macro-example-tests commit aac8d684740fd9a54495c9d78e6e426cb1c0c668 Author: Doug Gregor <[email protected]> Date: Sun Jul 2 11:34:28 2023 -0700 [Macros] Implement function body macros Introduce function body macros, which are comprised of two similar macro roles: - Preamble macros introduce "preamble" code into a user-written function body, e.g., to perform tracing, logging, check additional preconditions, etc. - Body macros: introduce a function body into a function that has none or wholesale replace the function body. commit 576cbb6aea8e289d34aef156cd50484165c23c6a Author: Doug Gregor <[email protected]> Date: Wed Nov 15 15:59:40 2023 -0800 Regenerate commit 331292ff4c9d4ae54fe5710941c639ad7f5a904d Author: Doug Gregor <[email protected]> Date: Wed Nov 15 15:57:53 2023 -0800 Make CodeBlockSynax parseable commit ed7e66dc0137e0d55eaa65c694447215219664e8 Author: Doug Gregor <[email protected]> Date: Wed Nov 15 16:01:16 2023 -0800 Add release note for WithOptionalCodeBlock commit 93dfd8f9549ece09f711b852ab0435dcdf4646cc Author: Doug Gregor <[email protected]> Date: Wed Nov 15 14:20:29 2023 -0800 Adopt With(Optional)CodeBlockSyntax in SwiftSyntaxBuilder These traits cover the `body` that's a code block in various syntax nodes. Make `HasTrailingCodeBlock` inherit from `WithCodeBlock`. It only applies to a subset of Eliminate `HasTrailingOptionalCodeBlock` in favor of `WithOptionalCodeBlock`. We don't need the extra protocol for customization. commit 967c838b6d497f3964c74cb62b821a8cd77e4fc9 Author: Doug Gregor <[email protected]> Date: Wed Nov 15 14:12:53 2023 -0800 Regenerate commit 745a8b9d88d3f4f06f0878c3cd7be802afc0080e Author: Doug Gregor <[email protected]> Date: Wed Nov 15 14:10:47 2023 -0800 Add WithOptionalCodeBlock trait and adopt it where there's a body commit 3914c0b466ce375561f6061a03fe69d0682975a8 Author: Joe Newton <[email protected]> Date: Wed Nov 15 17:03:12 2023 -0500 De-duplicated diagnostic (#2353) commit 806121d816c7a78ca195bab7ba0d6262bc4fd9e9 Merge: d9ae4487 bc74142c Author: Holly Borla <[email protected]> Date: Wed Nov 15 14:57:28 2023 -0500 Merge pull request #2357 from hborla/minor-concurrency-annotations [NFC] Minor annotations to minimize diagnostics under strict concurrency checking. commit f567587ac26b5dc9534f0086a9ed524f66c49062 Author: Mateusz Bąk <[email protected]> Date: Sun Nov 5 17:23:35 2023 +0100 Add fix-it handling tests for macro examples It introduces an enhancement to our macro expansion functionality with the addition of fix-it tests. In `AddBlockerTests`, a new test case has been added to validate the scenario where an addition operation should be a subtraction, including a diagnostic message and the application of the suggested fix-it. Similarly, `AddCompletionHandlerMacroTests` is now equipped with a test case that applies a fix-it for adding the 'async' keyword to functions that are missing it but have the `@AddCompletionHandler` attribute. commit bc74142ce247a40fc26f921ba8a10b0cf60edf46 Author: Holly Borla <[email protected]> Date: Tue Nov 14 22:57:35 2023 -0500 [NFC] Minor annotations to minimize diagnostics under strict concurrency checking. commit d9ae44871fb9a5400da410d75afb6f73cecd0d69 Merge: 0e6e9745 1bd7cd44 Author: Alex Hoppen <[email protected]> Date: Mon Nov 13 15:20:51 2023 -0800 Merge pull request #2337 from ahoppen/ahoppen/fix-it-location-translations Adjust locations for edits based on detached nodes when computing `fixedSource` commit 0e6e97454b3d6c66fd6795d3b89855043fe978f5 Merge: a1ecf4a2 e8190f9c Author: Alex Hoppen <[email protected]> Date: Mon Nov 13 12:46:50 2023 -0800 Merge pull request #2330 from stephencelis/patch-3 Add MacroExpansionNoteMessage commit a1ecf4a2af76e3d4731411819b970e83d61c08b5 Merge: 23d207d0 10d2d459 Author: Rintaro Ishizaki <[email protected]> Date: Mon Nov 13 10:50:31 2023 -0800 Merge pull request #2351 from rintaro/syntaxenum-per-base Add SyntaxEnum per base syntax kind commit 10d2d459e41aecd17d651b2cf23cef07a889ebd4 Author: Rintaro Ishizaki <[email protected]> Date: Fri Nov 10 16:40:43 2023 -0800 Add Release notes for base specific SyntaxEnum commit e9024bc146a7f49a0d3491fb0afa1be99b5ddb0d Author: Rintaro Ishizaki <[email protected]> Date: Fri Nov 10 16:24:33 2023 -0800 Add SyntaxEnum per base syntax kind Add DeclSyntaxEnum, StmtSyntaxEnum, ExprSyntaxEnum, TypeSyntaxEnum and PatternSyntaxEnum. These are useful for exhaustively enumerating specific syntax kind. commit 23d207d0b9057f02fcbdb2813f6ec832514c457c Merge: 39e732e2 53e9cf62 Author: Kim de Vos <[email protected]> Date: Sun Nov 12 01:00:37 2023 +0100 Merge pull request #2237 from kimdv/kimdv/remove-editor-placeholders commit 39e732e277b47a19b4f057cec971892d4c757156 Merge: 86783bde 0361e88b Author: Sophia Poirier <[email protected]> Date: Fri Nov 10 19:30:57 2023 -0800 Merge pull request #2342 from sophiapoirier/nonisolated-unsafe-experimental-feature-flag guard nonisolated(unsafe) by experimental feature commit e8190f9c4c1e023c504155a4b6531569a8214162 Author: Stephen Celis <[email protected]> Date: Fri Nov 10 13:13:06 2023 -0800 Update Sources/SwiftSyntaxMacros/MacroExpansionDiagnosticMessages.swift Co-authored-by: Mateusz Bąk <[email protected]> commit 0361e88b10b63030259b6d5c47d58f91c6f9a271 Author: Sophia Poirier <[email protected]> Date: Wed Nov 8 11:22:57 2023 -0800 guard nonisolated(unsafe) by experimental feature commit 86783bde837ac58d06de3411745a631d1a9e39bc Merge: 1c7f5bfc d0731f19 Author: Alex Hoppen <[email protected]> Date: Thu Nov 9 18:59:16 2023 -0800 Merge pull request #2349 from ahoppen/ahoppen/migration/steps Add migration steps for all deprecations and API-incompatible changes commit 1c7f5bfc352eac385d88302c780793798ea67707 Merge: f863f2e6 178cfd22 Author: Alex Hoppen <[email protected]> Date: Thu Nov 9 17:01:06 2023 -0800 Merge pull request #2345 from ahoppen/ahoppen/space-between-string-and-dot Don't add a space between literals and period in BasicFormat commit f863f2e6e1a49cdba3f7bb370c41c952b7a9771c Merge: cf3fbfd2 7d54c652 Author: Alex Hoppen <[email protected]> Date: Thu Nov 9 16:58:04 2023 -0800 Merge pull request #2343 from Matejkob/build-refactor-extension Remove Package.resolved post dependency resolution commit c9e38cd32b495ffbd39c8563db8a75f39d51e149 Author: Stephen Celis <[email protected]> Date: Thu Nov 9 15:13:16 2023 -0800 Update MacroExpansionDiagnosticMessages.swift commit 88f1405adf8f779c9411dc5b6a9357e7026c9d39 Merge: 932be63b cf3fbfd2 Author: Stephen Celis <[email protected]> Date: Thu Nov 9 15:12:33 2023 -0800 Merge branch 'main' into patch-3 commit d0731f19b159c492f9c3a9a02d7fea00fc6fec53 Author: Alex Hoppen <[email protected]> Date: Thu Nov 9 14:44:59 2023 -0800 Add migration steps for all deprecations and API-incompatible changes This should make it easier for clients to migrate to new versions of swift-syntax. commit 1bd7cd4471883314782be7699cb7a03a40752de8 Author: Alex Hoppen <[email protected]> Date: Tue Nov 7 16:23:42 2023 -0800 Adjust locations for edits based on detached nodes when computing `fixedSource` The Fix-Its returned by the macro are defined in terms of the nodes that it got passed and thus their positions are relative to the start of the detached nodes that get passed to the macro. We need to translate these offsets back to the the offsets in the original source file before computing edits and apply the offset-based edits. Fixes #2332 rdar://118012820 commit cf3fbfd21188384a92722e997a42e4cee778a00e Merge: 52859074 ce83709b Author: Alex Hoppen <[email protected]> Date: Thu Nov 9 14:09:20 2023 -0800 Merge pull request #2338 from ahoppen/ahoppen/move-diag-messages Move `MacroExpansion{Error|Warning|FixIt}Message` to the `SwiftSyntaxMacros` module commit 178cfd22b1745b8242ac3c8564aee703303e0fd8 Author: Alex Hoppen <[email protected]> Date: Thu Nov 9 13:02:08 2023 -0800 Don't add a space between literals and period in BasicFormat Fixes https://github.com/apple/swift-syntax/issues/2344 rdar://118176218 commit 53e9cf629b3423af135942235c239caef39f659b Author: Kim de Vos <[email protected]> Date: Mon Nov 6 21:25:46 2023 +0100 Deprecate placeholder nodes commit 7d54c6521524df1f6851d7a9f6fdb84549296d6c Author: Mateusz Bąk <[email protected]> Date: Thu Nov 9 08:20:03 2023 +0100 Remove Package.resolved post dependency resolution Removes the Package.resolved file that was auto-deleted by Xcode after resolving the dependency graph in SwiftRefactorExtension project. commit 52859074c793a46a0446e8b225686a0f5ce19d97 Merge: b73118c8 e79e22b3 Author: Meghana Gupta <[email protected]> Date: Wed Nov 8 18:55:55 2023 -0800 Merge pull request #2281 from apple/resultDependsOn Add initial support for _resultDependsOnSelf commit e79e22b3219f03893259bd16e0447c4cc227194c Author: Meghana Gupta <[email protected]> Date: Wed Nov 8 01:40:09 2023 -0800 Add initial support for _resultDependsOnSelf Add under NonEscapableTypes experimental feature commit b73118c8637138dae30f9e26f9dcb8dbf82b6044 Merge: 07475472 c7f3b832 Author: Alex Hoppen <[email protected]> Date: Wed Nov 8 07:35:56 2023 -0800 Merge pull request #2336 from ahoppen/ahoppen/codegen-509-for-real Make CodeGeneration depend on swift-syntax 509 commit 0747547222537d8d3a07f41db5dd7886754108a1 Merge: db0aad76 1d84c201 Author: Alex Hoppen <[email protected]> Date: Tue Nov 7 18:02:04 2023 -0800 Merge pull request #2314 from joehsieh/add-fix-it-extesion Add edits to FixIt for sourcekit-lsp to access commit db0aad76beeb038c6142104fd6e16c751ae92ff9 Merge: ece80d5f 05de293c Author: Sophia Poirier <[email protected]> Date: Tue Nov 7 17:44:36 2023 -0800 Merge pull request #2335 from sophiapoirier/nonisolated-unsafe-invalid-argument reject invalid arguments to nonisolated contextual keyword commit ece80d5f256f83c3e7060f31def63f778e49405e Merge: feb10f6e b3a3f1fd Author: Ben Barham <[email protected]> Date: Tue Nov 7 17:03:41 2023 -0800 Merge pull request #2315 from bnbarham/remove-initializer MacroSystem should remove the initializer for an accessor macro commit ce83709ba499936d4f651ba4524d25a5c37057a3 Author: Alex Hoppen <[email protected]> Date: Tue Nov 7 16:54:48 2023 -0800 Move `MacroExpansion{Error|Warning|FixIt}Message` to the `SwiftSyntaxMacros` module The expansion diagnostic messages were defined in `SwiftSyntaxMacroExpansion`, which is intended as an implementation detail of the plugin server and should not need to be imported by macros. Move them to the `SwiftSyntaxMacros` module where they belong. commit 05de293cc214df55217d2f2d052eb0cf7f6b35bd Author: Sophia Poirier <[email protected]> Date: Tue Nov 7 11:40:52 2023 -0800 reject invalid arguments to nonisolated contextual keyword commit c7f3b83292c47e454b830afa01c0b64cdca38caa Author: Alex Hoppen <[email protected]> Date: Tue Nov 7 14:28:18 2023 -0800 Make CodeGeneration depend on swift-syntax 509 https://github.com/apple/swift-syntax/pull/2239 was meant to make Generation depend on swift-syntax 509 but it didn’t actually flip the switch. Do so now. commit feb10f6e646f4fbcb9eef4b3e875feb310584273 Merge: 098b1778 cc92c30a Author: Alex Hoppen <[email protected]> Date: Tue Nov 7 14:01:32 2023 -0800 Merge pull request #2322 from jpsim/mark-syntaxchildrenindex-as-sendable Mark `SyntaxChildrenIndex` as `Sendable` commit 932be63b994f04056cd5ff2c73c379dbfc60085e Author: Stephen Celis <[email protected]> Date: Mon Nov 6 09:38:36 2023 -0800 Add MacroExpansionNoteMessage commit 098b177830c0d2e614b3757241b2572d758f9143 Merge: 7cff2603 4ec2b5e4 Author: Kim de Vos <[email protected]> Date: Sun Nov 5 13:40:29 2023 +0100 Merge pull request #2021 from kimdv/kimdv/2015-add-a-fixedsource-parameter-to-assertmacroexpansion commit b3a3f1fd7b3a4f67234c11e54bb1d65714e22e13 Author: Ben Barham <[email protected]> Date: Tue Oct 24 09:21:31 2023 -0700 MacroSystem should remove the initializer for an accessor macro SE-0389 specifies that a macro returning either a getter or setter should remove the initializer, if one exists. Resolves rdar://117442713 (#2310) commit 1d84c201cca066ff6b3efa5b9a2fca3455200f95 Author: joehsieh <[email protected]> Date: Fri Oct 27 21:49:27 2023 +0900 Add edits to FixIt for sourcekit-lsp to access Finetue the code Refine the code Finetune the code Add unit tests Finetune the code Update the code per comments Simplify the test Move the SourceEdit.swift from module SwiftDiagnostics to module SwiftSyntax Add copyright to new files Update unit tests to align the convention and update release noten Finetune the code Update release note Add missing SourceEdit.swift to CMakelists.txt Format the code commit 4ec2b5e407eba3260534ee7fbcd23aa869d5e169 Author: Kim de Vos <[email protected]> Date: Wed Oct 18 13:28:42 2023 +0200 Add fixed source to `assertMacroExpansion` commit 7cff2603808f6e9e6e3e4232001f042b565d7ccf Merge: 7f67403f 6c650443 Author: Alex Hoppen <[email protected]> Date: Wed Nov 1 18:04:17 2023 -0700 Merge pull request #2239 from ahoppen/ahoppen/codegen-509 commit 7f67403f44c7b2a7dad1a13eaf891f6e2aa4f5ff Merge: 06b41795 f884d06c Author: Alex Hoppen <[email protected]> Date: Wed Nov 1 16:17:57 2023 -0700 Merge pull request #1822 from stephencelis/patch-1 commit 06b417950cdbe7f5591bb6849bf36c40fcfe69ad Merge: d6b6631c b80422c1 Author: Alex Hoppen <[email protected]> Date: Wed Nov 1 07:36:23 2023 -0700 Merge pull request #2022 from ahoppen/ahoppen/format-in-swift Re-architect format.py in swift commit cc92c30a292bad2750e4a43173749990e25aadf5 Author: JP Simard <[email protected]> Date: Wed Nov 1 09:46:57 2023 -0400 Mark `SyntaxChildrenIndex` as `Sendable` Otherwise consumers of SwiftSyntax may encounter warnings when compiling with `-strict-concurrency=complete`. For example: ```swift extension DeclModifierListSyntax { var fileprivateModifierIndex: DeclModifierListSyntax.Index? { firstIndex(where: { $0.name.tokenKind == .keyword(.fileprivate) }) } var fileprivateModifier: DeclModifierSyntax? { fileprivateModifierIndex.flatMap { self[$0] } } func replacing(fileprivateModifierIndex: DeclModifierListSyntax.Index) -> DeclModifierListSyntax { let fileprivateModifier = self[fileprivateModifierIndex] return with( \.[fileprivateModifierIndex], fileprivateModifier.with( \.name, .keyword( .private, leadingTrivia: fileprivateModifier.leadingTrivia, trailingTrivia: fileprivateModifier.trailingTrivia ) ) ) } } ``` Produces the following warning: > cannot form key path that captures non-sendable type > 'DeclModifierListSyntax.Index' (aka 'SyntaxChildrenIndex') commit 6c65044378ed28ddac3f65a5d3997feaf6fb65cc Author: Alex Hoppen <[email protected]> Date: Tue Oct 31 19:24:02 2023 -0700 Make CodeGeneration depend on swift-syntax 509.0.0 Having CodeGeneration depend on a stable version of swift-syntax makes rebasing changes a lot easier because CodeGeneration no longer depends on itself. commit d6b6631c61ae46628c1c6a001899df314dd75486 Merge: ebd7026d 8566db0c Author: Alex Hoppen <[email protected]> Date: Tue Oct 31 19:16:00 2023 -0700 Merge pull request #2319 from ahoppen/ahoppen/infinite-recursion Throw an error if types conforming to `MemberMacro` implement no `expansion` method commit 8566db0cb7a921d59db72cb4f02050e407c2a6ca Author: Alex Hoppen <[email protected]> Date: Tue Oct 31 13:10:31 2023 -0700 Throw an error if types conforming to `MemberMacro` implement no `expansion` method When adding a new type that conforms to `MemberMacro`, no `expansion` function is required to be implemented. It’s necessary to do it this way because: - `expansion(of:providingMembersOf:in:)` needs to exist as a protocol requirement to keep Swift 5.9 macros that implement this method compiling - `expansion(of:providingMembersOf:in:)` needs to be defaulted so that macros implementing `expansion(of:providingMembersOf:conformingTo:in:)` don’t need to also provide an implementation for the legacy version that doesn’t have `conformingTo:` - `expansion(of:providingMembersOf:conformingTo:in:)` obviously needs to exist since it’s the new dedicated entry point - `expansion(of:providingMembersOf:conformingTo:in:)` needs to have a default implementation that calls `expansion(of:providingMembersOf:in:)` so that 5.9 macros continue to work - We can’t mark `expansion(of:providingMembersOf:in:)` as deprecated because it’s called by the default implementation of `expansion(of:providingMembersOf:conformingTo:in:)` and we want to keep swift-syntax building without warnings. At the moment, we provide default implementations for both `expansion` functions that call each other, which causes an infinite recursion, that makes it non-obvious to see what’s going wrong. With this change, the default implementation of the legacy `expansion(of:providingMembersOf:in:)` method throws an error saying that you need to implement either of the two expansion methods. That way you get the following behavior: - If you don’t implement either expansion function, the error gets thrown - If a macro implements the legacy `expansion(of:providingMembersOf:in:)` function, then it overrides the throwing version and the macro works. - If a macro implements the new `expansion(of:providingMembersOf:conformingTo:in:)` method, then the compiler calls into that method directly and the legacy `expansion(of:providingMembersOf:in:)` never gets invoked by the compiler. The only possible issue I can think of is if a library is calling `expansion(of:providingMembersOf:in:)` but the macro only implements `expansion(of:providingMembersOf:conformingTo:in:)`. In this case an error would get thrown where it currently isn’t. But since I don’t see any reason why anyone would be calling `expansion(of:providingMembersOf:in:)` directly, I think this is fine. commit 66f7215b94acdd3b93a20ce2e03f6cb74b5278e1 Author: Saleem Abdulrasool <[email protected]> Date: Fri Oct 13 13:26:19 2023 -0700 build: enable Macros examples on other platforms Windows and Linux now support the macros as well. Enable this to make it easier to run the examples. commit b80422c194dc7140d599b8ff0964f1dc4d8476ac Author: Alex Hoppen <[email protected]> Date: Mon Sep 25 13:46:12 2023 -0700 Re-architect format.py in swift Make a couple of changes to `format.py` and use the opportunity to re-write it in Swift. 1. Always build a local copy of swift-format in `swift-syntax/.swift-format-build` in release mode. This eliminates issues that occur if you had `swift-format` installed on your system and `format.py` would pick it up 2. Since the local swift-format build is persistent (doesn’t live in `/tmp`), we can build it in release. This increases the first run but decreases the time for any subsequent runs from ~15s to ~1s, which should pay usually pay off for frequent contributors because of faster turnaround times. 3. Add a little tip to add `swift-format` as a git hook to Contributing.md And as an added bonus, the rewrite reduced the runtime of `format.(py|swift)` from 1.2s to 900ms. commit feee0efca0f669c21478d4429ce8ffb4ffa571ef Author: Alex Hoppen <[email protected]> Date: Mon Sep 25 12:59:14 2023 -0700 [swift-syntax-dev-utils] Throw an error in if an executable could not be found commit f884d06c00811214092995b0a3696ac9cb14c920 Author: Stephen Celis <[email protected]> Date: Tue Jun 20 09:20:26 2023 -0700 Conform `MessageID` and `DiagnosticSeverity` to `Sendable`
It seems that this bug can lead to the execution of the wrong code, i.e. the original initializer instead of the macro-inserted code: swiftlang/swift#71070 |
The issue as described here was referring to the expansion from |
Test code: the AutoEnvironmentKey branch of my fork of swift-macro-examples
Toolchain: the latest nightly, swift-DEVELOPMENT-SNAPSHOT-2023-02-15-a in Xcode 14.2 (14C18) on macOS 13.2.1 (22D68).
SE-0389, Attached Macros, says
The
AutoEnvironmentKey
macro in the linked repo is an accessor macro that does not specify eitherwillSet
ordidSet
, and indeed it returnsget
andset
accessors in its expansion. But swiftc does not remove the initializer. ThetestAutoEnvironmentKey
test case demonstrates this. It uses this input syntax:and expects this output syntax:
but the actual expanded syntax is this:
Note that the initializer has not been removed from the actual expanded syntax.
The text was updated successfully, but these errors were encountered: