[SR-11037] Parser should check for the wrong kind of platform condition #53426
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
good first issue
Good for newcomers
parser
Area → compiler: The legacy C++ parser
Additional Detail from JIRA
md5: f0eda31a231fbda1905bf0d463f540ff
Issue Description:
Suppose you write this:
"simulator" is not a known OS, so Swift looks for the closest matching OSes and suggests them instead:
But it might be better to suggest changing "os" to "targetEnvironment", since "targetEnvironment(simulator)" is a valid platform condition.
If you want to fix this, look for the call to checkPlatformConditionSupported() in ParseIfConfig.cpp. The easiest implementation would be to simply try each of the other platform condition kinds and attach an appropriate fix-it if any of them are valid, but it might be possible to do something more clever by modifying how checkPlatformConditionSupported() communicates suggestions back to its caller.
The text was updated successfully, but these errors were encountered: