Missing warning "has duplicate entries for integer literal key" when literal keys are produced by a macro #77318
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
swift macro
Feature → declarations: Swift `macro` declarations
Description
When using a literal dictionary with literal keys which are produced by a macro, no warning is given for duplicate keys.
Reproduction
The following code uses the macro
#codepointForEntity
from https://github.com/stefanspringer1/CodepointForEntityMacro.git:No warning is given, but the execution results in a
Trace/BPT trap: 5
error.The macro produces the following code with a duplicate key:
If this code is directly used (without the macro), the following warning is given:
Dictionary literal of type '[UInt32 : String]' has duplicate entries for integer literal key '0xBD'
Expected behavior
It would be very convenient to have the warning also when the macro is used.
Environment
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx14.0
Additional information
Note that for duplicate entries of a dictionary, there also is the issue #78595 "Dictionary literal has duplicate entries" should be an error not warning.
The text was updated successfully, but these errors were encountered: