@@ -1306,24 +1306,25 @@ validateAvailabilitySpecList(Parser &P,
13061306 for (auto *Spec : Specs) {
13071307 RecognizedSpecs.push_back (Spec);
13081308 if (auto *OtherPlatSpec = dyn_cast<OtherPlatformAvailabilitySpec>(Spec)) {
1309- OtherPlatformSpecLoc = OtherPlatSpec->getStarLoc ();
1309+ OtherPlatformSpecLoc = OtherPlatSpec->getStartLoc ();
13101310 continue ;
13111311 }
13121312
13131313 if (auto *PlatformAgnosticSpec =
13141314 dyn_cast<PlatformAgnosticVersionConstraintAvailabilitySpec>(Spec)) {
1315- P.diagnose (PlatformAgnosticSpec->getPlatformAgnosticNameLoc (),
1315+ bool isLanguageVersionSpecific = PlatformAgnosticSpec->getDomain ()->isSwiftLanguage ();
1316+ P.diagnose (PlatformAgnosticSpec->getStartLoc (),
13161317 diag::availability_must_occur_alone,
1317- PlatformAgnosticSpec-> isLanguageVersionSpecific ()
1318- ? " swift"
1319- : " _PackageDescription" );
1318+ isLanguageVersionSpecific
1319+ ? " swift"
1320+ : " _PackageDescription" );
13201321 continue ;
13211322 }
13221323
13231324 auto *VersionSpec = cast<PlatformVersionConstraintAvailabilitySpec>(Spec);
13241325 // We keep specs for unrecognized platforms around for error recovery
13251326 // during parsing but remove them once parsing is completed.
1326- if (VersionSpec->isUnrecognizedPlatform ()) {
1327+ if (! VersionSpec->getDomain (). has_value ()) {
13271328 RecognizedSpecs.pop_back ();
13281329 continue ;
13291330 }
@@ -1334,7 +1335,7 @@ validateAvailabilitySpecList(Parser &P,
13341335 // For example, we emit an error for
13351336 // / #available(OSX 10.10, OSX 10.11, *)
13361337 PlatformKind Platform = VersionSpec->getPlatform ();
1337- P.diagnose (VersionSpec->getPlatformLoc (),
1338+ P.diagnose (VersionSpec->getStartLoc (),
13381339 diag::availability_query_repeated_platform,
13391340 platformString (Platform));
13401341 }
@@ -1404,8 +1405,9 @@ ParserResult<PoundAvailableInfo> Parser::parseStmtConditionPoundAvailable() {
14041405 for (auto *Spec : Specs) {
14051406 if (auto *PlatformAgnostic =
14061407 dyn_cast<PlatformAgnosticVersionConstraintAvailabilitySpec>(Spec)) {
1407- diagnose (PlatformAgnostic->getPlatformAgnosticNameLoc (),
1408- PlatformAgnostic->isLanguageVersionSpecific ()
1408+ bool isLanguageVersionSpecific = PlatformAgnostic->getDomain ()->isSwiftLanguage ();
1409+ diagnose (PlatformAgnostic->getStartLoc (),
1410+ isLanguageVersionSpecific
14091411 ? diag::pound_available_swift_not_allowed
14101412 : diag::pound_available_package_description_not_allowed,
14111413 getTokenText (MainToken));
@@ -1551,11 +1553,10 @@ Parser::parseAvailabilitySpecList(SmallVectorImpl<AvailabilitySpec *> &Specs,
15511553 auto *PlatformSpec =
15521554 cast<PlatformVersionConstraintAvailabilitySpec>(Previous);
15531555
1554- auto PlatformNameEndLoc =
1555- Lexer::getLocForEndOfToken (SourceManager,
1556- PlatformSpec->getPlatformLoc ());
1556+ auto PlatformNameEndLoc = Lexer::getLocForEndOfToken (
1557+ SourceManager, PlatformSpec->getStartLoc ());
15571558
1558- diagnose (PlatformSpec->getPlatformLoc (),
1559+ diagnose (PlatformSpec->getStartLoc (),
15591560 diag::avail_query_meant_introduced)
15601561 .fixItInsert (PlatformNameEndLoc, " , introduced:" );
15611562 }
0 commit comments