Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/Parse/ParseIfConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ class ValidateIfConfigCondition :
diag::unsupported_platform_runtime_condition_argument);
return nullptr;
}

// Just a warning for other unsupported arguments.
StringRef DiagName;
switch (*Kind) {
case PlatformConditionKind::OS:
Expand All @@ -338,7 +340,6 @@ class ValidateIfConfigCondition :
for (auto suggestion : suggestions)
D.diagnose(Loc, diag::note_typo_candidate, suggestion)
.fixItReplace(Arg->getSourceRange(), suggestion);
return nullptr;
}

return E;
Expand Down
24 changes: 24 additions & 0 deletions test/Parse/ConditionalCompilation/basicParseErrors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,27 @@ undefinedFunc() // ignored.
#else
undefinedFunc() // expected-error {{use of unresolved identifier 'undefinedFunc'}}
#endif

/// Invalid platform condition arguments don't invalidate the whole condition.
#if !arch(tecture) && !os(ystem) && !_endian(ness)
// expected-warning@-1 {{unknown architecture for build configuration 'arch'}}
// expected-note@-2 {{did you mean 'arm'?}} {{11-18=arm}}
// expected-warning@-3 {{unknown operating system for build configuration 'os'}}
// expected-note@-4 {{did you mean 'OSX'?}} {{27-32=OSX}}
// expected-note@-5 {{did you mean 'PS4'?}} {{27-32=PS4}}
// expected-warning@-6 {{unknown endianness for build configuration '_endian'}}
// expected-note@-7 {{did you mean 'big'?}} {{46-50=big}}
func fn_k() {}
#endif
fn_k()

#if os(cillator) || arch(ive)
// expected-warning@-1 {{unknown operating system for build configuration 'os'}}
// expected-note@-2 {{did you mean 'macOS'?}} {{8-16=macOS}}
// expected-note@-3 {{did you mean 'iOS'?}} {{8-16=iOS}}
// expected-warning@-4 {{unknown architecture for build configuration 'arch'}}
// expected-note@-5 {{did you mean 'arm'?}} {{26-29=arm}}
// expected-note@-6 {{did you mean 'i386'?}} {{26-29=i386}}
func undefinedFunc() // ignored.
#endif
undefinedFunc() // expected-error {{use of unresolved identifier 'undefinedFunc'}}