Merge pull request #23360 from akyrtzi/fix-syntax-parser-assertion

[syntax parser] Fix assertion hit with invalid type parsing
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0359764..2dd294a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,10 @@
 Swift 5.1
 ---------
 
+* [SE-0068][]:
+
+  `Self` can now be used inside member functions and for function arguments of structs and enums to refer to the containing type.
+
 * [SR-7799][]:
 
   Enum cases can now be matched against an optional enum without
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ee7bef..1a2d856 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -250,10 +250,6 @@
     "Whether to enable CrashReporter integration"
     FALSE)
 
-option(SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
-    "Enable the Swift stable ABI's class marker bit for new deployment targets"
-    TRUE)
-
 set(SWIFT_DARWIN_XCRUN_TOOLCHAIN "XcodeDefault" CACHE STRING
     "The name of the toolchain to pass to 'xcrun'")
 
diff --git a/include/swift/AST/KnownIdentifiers.def b/include/swift/AST/KnownIdentifiers.def
index 5624a18..fc0a792 100644
--- a/include/swift/AST/KnownIdentifiers.def
+++ b/include/swift/AST/KnownIdentifiers.def
@@ -101,12 +101,7 @@
 IDENTIFIER(super)
 IDENTIFIER(superDecoder)
 IDENTIFIER(superEncoder)
-#if SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
 IDENTIFIER_WITH_NAME(SwiftObject, "_TtCs12_SwiftObject")
-#else
-// Pre-stable ABI uses un-mangled name for SwiftObject.
-IDENTIFIER(SwiftObject)
-#endif
 IDENTIFIER(to)
 IDENTIFIER(toRaw)
 IDENTIFIER(Type)
diff --git a/include/swift/Basic/LangOptions.h b/include/swift/Basic/LangOptions.h
index 9ad953c..88e0b47 100644
--- a/include/swift/Basic/LangOptions.h
+++ b/include/swift/Basic/LangOptions.h
@@ -137,8 +137,10 @@
     bool EnableObjCInterop = true;
 
     /// On Darwin platforms, use the pre-stable ABI's mark bit for Swift
-    /// classes instead of the stable ABI's bit.
-    bool UseDarwinPreStableABIBit = !bool(SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT);
+    /// classes instead of the stable ABI's bit. This is needed when
+    /// targeting OSes prior to macOS 10.14.4 and iOS 12.2, where
+    /// libobjc does not support the stable ABI's marker bit.
+    bool UseDarwinPreStableABIBit = false;
 
     /// Enables checking that uses of @objc require importing
     /// the Foundation module.
diff --git a/include/swift/Config.h.in b/include/swift/Config.h.in
index 08a847e..0b5534c 100644
--- a/include/swift/Config.h.in
+++ b/include/swift/Config.h.in
@@ -12,6 +12,4 @@
 
 #cmakedefine HAVE_PROC_PID_RUSAGE 1
 
-#cmakedefine01 SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
-
 #endif // SWIFT_CONFIG_H
diff --git a/include/swift/Frontend/FrontendOptions.h b/include/swift/Frontend/FrontendOptions.h
index 4fda1c7..8cbbc1f 100644
--- a/include/swift/Frontend/FrontendOptions.h
+++ b/include/swift/Frontend/FrontendOptions.h
@@ -220,9 +220,6 @@
   /// (if asked to emit SIL).
   bool EmitVerboseSIL = false;
 
-  /// If set, find and import parseable modules from .swiftinterface files.
-  bool EnableParseableModuleInterface = false;
-
   /// If set, this module is part of a mixed Objective-C/Swift framework, and
   /// the Objective-C half should implicitly be visible to the Swift sources.
   bool ImportUnderlyingModule = false;
diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td
index 23206af..07b9d50 100644
--- a/include/swift/Option/FrontendOptions.td
+++ b/include/swift/Option/FrontendOptions.td
@@ -174,6 +174,9 @@
   HelpText<"Disable requiring uses of @objc to require importing the "
            "Foundation module">;
 
+def enable_resilience : Flag<["-"], "enable-resilience">,
+   HelpText<"Deprecated, use -enable-library-evolution instead">;
+
 }
 
 
diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td
index a75cd72..8937bf1 100644
--- a/include/swift/Option/Options.td
+++ b/include/swift/Option/Options.td
@@ -346,11 +346,6 @@
   Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
          ArgumentIsPath]>,
   MetaVarName<"<path>">, HelpText<"Output parseable interface file to <path>">;
-def enable_parseable_module_interface :
-  Flag<["-"], "enable-parseable-module-interface">,
-  Flags<[FrontendOption, HelpHidden, NoInteractiveOption,
-         DoesNotAffectIncrementalBuild]>,
-  HelpText<"Accept parseable .swiftinterface form of modules">;
 
 def emit_objc_header : Flag<["-"], "emit-objc-header">,
   Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
diff --git a/include/swift/Runtime/CMakeConfig.h.in b/include/swift/Runtime/CMakeConfig.h.in
index 5bf783b..e24e5c3 100644
--- a/include/swift/Runtime/CMakeConfig.h.in
+++ b/include/swift/Runtime/CMakeConfig.h.in
@@ -4,7 +4,6 @@
 #ifndef SWIFT_RUNTIME_CMAKECONFIG_H
 #define SWIFT_RUNTIME_CMAKECONFIG_H
 
-#cmakedefine01 SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
 #cmakedefine01 SWIFT_BNI_OS_BUILD
 #cmakedefine01 SWIFT_BNI_XCODE_BUILD
 
diff --git a/lib/AST/DeclContext.cpp b/lib/AST/DeclContext.cpp
index 1951dd0..33af8d7 100644
--- a/lib/AST/DeclContext.cpp
+++ b/lib/AST/DeclContext.cpp
@@ -223,9 +223,8 @@
 DeclContext *DeclContext::getInnermostTypeContext() {
   auto dc = this;
   do {
-    if (auto decl = dc->getAsDecl())
-      if (isa<NominalTypeDecl>(decl) || isa<ExtensionDecl>(decl))
-        return dc;
+    if (dc->isTypeContext())
+      return dc;
   } while ((dc = dc->getParent()));
 
   return nullptr;
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index e539750..6160f1b 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -193,7 +193,6 @@
   inputArgs.AddLastArg(arguments, options::OPT_import_underlying_module);
   inputArgs.AddLastArg(arguments, options::OPT_module_cache_path);
   inputArgs.AddLastArg(arguments, options::OPT_module_link_name);
-  inputArgs.AddLastArg(arguments, options::OPT_enable_parseable_module_interface);
   inputArgs.AddLastArg(arguments, options::OPT_nostdimport);
   inputArgs.AddLastArg(arguments, options::OPT_parse_stdlib);
   inputArgs.AddLastArg(arguments, options::OPT_resource_dir);
diff --git a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp
index bfd343c..7fa1739 100644
--- a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp
+++ b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp
@@ -72,6 +72,10 @@
   Opts.EnableTesting |= Args.hasArg(OPT_enable_testing);
   Opts.EnablePrivateImports |= Args.hasArg(OPT_enable_private_imports);
   Opts.EnableLibraryEvolution |= Args.hasArg(OPT_enable_library_evolution);
+
+  // FIXME: Remove this flag
+  Opts.EnableLibraryEvolution |= Args.hasArg(OPT_enable_resilience);
+
   Opts.EnableImplicitDynamic |= Args.hasArg(OPT_enable_implicit_dynamic);
 
   Opts.TrackSystemDeps |= Args.hasArg(OPT_track_system_dependencies);
@@ -163,8 +167,6 @@
 
   Opts.EnableSourceImport |= Args.hasArg(OPT_enable_source_import);
   Opts.ImportUnderlyingModule |= Args.hasArg(OPT_import_underlying_module);
-  Opts.EnableParseableModuleInterface |=
-      Args.hasArg(OPT_enable_parseable_module_interface);
   Opts.EnableSerializationNestedTypeLookupTable &=
       !Args.hasArg(OPT_disable_serialization_nested_type_lookup_table);
 
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index a5099fa..0c05c2d 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -441,15 +441,11 @@
                    Target.isOSDarwin());
   Opts.EnableSILOpaqueValues |= Args.hasArg(OPT_enable_sil_opaque_values);
 
-#if SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
   Opts.UseDarwinPreStableABIBit =
     (Target.isMacOSX() && Target.isMacOSXVersionLT(10, 14, 4)) ||
     (Target.isiOS() && Target.isOSVersionLT(12, 2)) ||
     (Target.isTvOS() && Target.isOSVersionLT(12, 2)) ||
     (Target.isWatchOS() && Target.isOSVersionLT(5, 2));
-#else
-  Opts.UseDarwinPreStableABIBit = true;
-#endif
 
   Opts.DisableConstraintSolverPerformanceHacks |=
       Args.hasArg(OPT_disable_constraint_solver_performance_hacks);
diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp
index 88a2a04..7687744 100644
--- a/lib/Frontend/Frontend.cpp
+++ b/lib/Frontend/Frontend.cpp
@@ -293,10 +293,7 @@
                                                   enableLibraryEvolution,
                                                   getDependencyTracker()));
   }
-  auto MLM = ModuleLoadingMode::OnlySerialized;
-  if (Invocation.getFrontendOptions().EnableParseableModuleInterface) {
-    MLM = ModuleLoadingMode::PreferSerialized;
-  }
+  auto MLM = ModuleLoadingMode::PreferSerialized;
   if (auto forceModuleLoadingMode =
       llvm::sys::Process::GetEnv("SWIFT_FORCE_MODULE_LOADING")) {
     if (*forceModuleLoadingMode == "prefer-parseable")
diff --git a/lib/Frontend/ParseableInterfaceModuleLoader.cpp b/lib/Frontend/ParseableInterfaceModuleLoader.cpp
index 4de6630..238e527 100644
--- a/lib/Frontend/ParseableInterfaceModuleLoader.cpp
+++ b/lib/Frontend/ParseableInterfaceModuleLoader.cpp
@@ -258,7 +258,6 @@
   void configureSubInvocationInputsAndOutputs(StringRef OutPath) {
     auto &SubFEOpts = subInvocation.getFrontendOptions();
     SubFEOpts.RequestedAction = FrontendOptions::ActionType::EmitModuleOnly;
-    SubFEOpts.EnableParseableModuleInterface = true;
     SubFEOpts.InputsAndOutputs.addPrimaryInputFile(interfacePath);
     SupplementaryOutputPaths SOPs;
     SOPs.ModuleOutputPath = OutPath.str();
@@ -713,9 +712,6 @@
     if (validationInfo.status != serialization::Status::Valid)
       return false;
 
-    assert(validationInfo.name == moduleName &&
-           "we built a module at this path with a different name?");
-
     return dependenciesAreUpToDate(allDeps);
   }
 
diff --git a/lib/IDE/ExprContextAnalysis.cpp b/lib/IDE/ExprContextAnalysis.cpp
index 2a128ed..32a1df2 100644
--- a/lib/IDE/ExprContextAnalysis.cpp
+++ b/lib/IDE/ExprContextAnalysis.cpp
@@ -325,6 +325,8 @@
     if ((!isa<AbstractFunctionDecl>(VD) && !isa<SubscriptDecl>(VD)) ||
         VD->shouldHideFromEditor())
       continue;
+    if (!isMemberDeclApplied(&DC, baseTy->getMetatypeInstanceType(), VD))
+      continue;
     resolver->resolveDeclSignature(VD);
     if (!VD->hasInterfaceType())
       continue;
diff --git a/lib/IRGen/GenMeta.cpp b/lib/IRGen/GenMeta.cpp
index 249ebc0..92b59e5 100644
--- a/lib/IRGen/GenMeta.cpp
+++ b/lib/IRGen/GenMeta.cpp
@@ -2411,12 +2411,6 @@
 static ClassFlags getClassFlags(ClassDecl *classDecl) {
   auto flags = ClassFlags();
 
-#if !SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
-  // FIXME: Remove this after enabling stable ABI.
-  // This bit is NOT conditioned on UseDarwinPreStableABIBit.
-  flags |= ClassFlags::IsSwiftPreStableABI;
-#endif
-
   // Set a flag if the class uses Swift refcounting.
   auto type = classDecl->getDeclaredType()->getCanonicalType();
   if (type->getReferenceCounting() == ReferenceCounting::Native) {
diff --git a/lib/SILOptimizer/Utils/Generics.cpp b/lib/SILOptimizer/Utils/Generics.cpp
index 7c6d724..5044ce2 100644
--- a/lib/SILOptimizer/Utils/Generics.cpp
+++ b/lib/SILOptimizer/Utils/Generics.cpp
@@ -2527,6 +2527,8 @@
 };
 
 bool swift::isKnownPrespecialization(StringRef SpecName) {
+  // Completely disable for now.
+#if false
   // TODO: Once there is an efficient API to check if
   // a given symbol is a specialization of a specific type,
   // use it instead. Doing demangling just for this check
@@ -2577,6 +2579,7 @@
     }
   }
 
+#endif
   return false;
 }
 
diff --git a/lib/Sema/TypeCheckConstraints.cpp b/lib/Sema/TypeCheckConstraints.cpp
index 5574e65..daee66f 100644
--- a/lib/Sema/TypeCheckConstraints.cpp
+++ b/lib/Sema/TypeCheckConstraints.cpp
@@ -551,6 +551,18 @@
     };
 
     if (!isConfused) {
+      if (Name == Context.Id_Self) {
+        if (DeclContext *typeContext = DC->getInnermostTypeContext()){
+          Type SelfType = typeContext->getSelfInterfaceType();
+
+          if (typeContext->getSelfClassDecl())
+            SelfType = DynamicSelfType::get(SelfType, Context);
+          SelfType = DC->mapTypeIntoContext(SelfType);
+          return new (Context) TypeExpr(TypeLoc(new (Context)
+                                                FixedTypeRepr(SelfType, Loc)));
+        }
+      }
+
       TypoCorrectionResults corrections(*this, Name, nameLoc);
       performTypoCorrection(DC, UDRE->getRefKind(), Type(),
                             lookupOptions, corrections);
diff --git a/lib/Sema/TypeCheckStmt.cpp b/lib/Sema/TypeCheckStmt.cpp
index 494e5ca..bd8c4a0 100644
--- a/lib/Sema/TypeCheckStmt.cpp
+++ b/lib/Sema/TypeCheckStmt.cpp
@@ -946,29 +946,166 @@
     PreviousFallthrough = S;
     return S;
   }
-  
-  Stmt *visitSwitchStmt(SwitchStmt *S) {
+
+  void checkCaseLabelItem(CaseStmt *caseBlock, CaseLabelItem &labelItem,
+                          bool &limitExhaustivityChecks, Type subjectType) {
+    SWIFT_DEFER {
+      // Check the guard expression, if present.
+      if (auto *guard = labelItem.getGuardExpr()) {
+        limitExhaustivityChecks |= TC.typeCheckCondition(guard, DC);
+        labelItem.setGuardExpr(guard);
+      }
+    };
+
+    Pattern *pattern = labelItem.getPattern();
+    auto *newPattern = TC.resolvePattern(pattern, DC,
+                                         /*isStmtCondition*/ false);
+    if (!newPattern)
+      return;
+    pattern = newPattern;
+    // Coerce the pattern to the subject's type.
+    TypeResolutionOptions patternOptions(TypeResolverContext::InExpression);
+    if (!subjectType ||
+        TC.coercePatternToType(pattern, TypeResolution::forContextual(DC),
+                               subjectType, patternOptions)) {
+      limitExhaustivityChecks = true;
+
+      // If that failed, mark any variables binding pieces of the pattern
+      // as invalid to silence follow-on errors.
+      pattern->forEachVariable([&](VarDecl *VD) { VD->markInvalid(); });
+    }
+    labelItem.setPattern(pattern);
+
+    // For each variable in the pattern, make sure its type is identical to what
+    // it was in the first label item's pattern.
+    auto *firstPattern = caseBlock->getCaseLabelItems()[0].getPattern();
+    SmallVector<VarDecl *, 4> vars;
+    firstPattern->collectVariables(vars);
+    pattern->forEachVariable([&](VarDecl *vd) {
+      if (!vd->hasName())
+        return;
+      for (auto *expected : vars) {
+        if (expected->hasName() && expected->getName() == vd->getName()) {
+          if (vd->hasType() && expected->hasType() && !expected->isInvalid() &&
+              !vd->getType()->isEqual(expected->getType())) {
+            TC.diagnose(vd->getLoc(), diag::type_mismatch_multiple_pattern_list,
+                        vd->getType(), expected->getType());
+            vd->markInvalid();
+            expected->markInvalid();
+          }
+          if (expected->isLet() != vd->isLet()) {
+            auto diag = TC.diagnose(
+                vd->getLoc(), diag::mutability_mismatch_multiple_pattern_list,
+                vd->isLet(), expected->isLet());
+
+            VarPattern *foundVP = nullptr;
+            vd->getParentPattern()->forEachNode([&](Pattern *P) {
+              if (auto *VP = dyn_cast<VarPattern>(P))
+                if (VP->getSingleVar() == vd)
+                  foundVP = VP;
+            });
+            if (foundVP)
+              diag.fixItReplace(foundVP->getLoc(),
+                                expected->isLet() ? "let" : "var");
+            vd->markInvalid();
+            expected->markInvalid();
+          }
+          return;
+        }
+      }
+    });
+  }
+
+  void checkUnknownAttrRestrictions(CaseStmt *caseBlock,
+                                    bool &limitExhaustivityChecks) {
+    if (caseBlock->getCaseLabelItems().size() != 1) {
+      assert(!caseBlock->getCaseLabelItems().empty() &&
+             "parser should not produce case blocks with no items");
+      TC.diagnose(caseBlock->getLoc(), diag::unknown_case_multiple_patterns)
+          .highlight(caseBlock->getCaseLabelItems()[1].getSourceRange());
+      limitExhaustivityChecks = true;
+    }
+
+    if (FallthroughDest != nullptr) {
+      if (!caseBlock->isDefault())
+        TC.diagnose(caseBlock->getLoc(), diag::unknown_case_must_be_last);
+      limitExhaustivityChecks = true;
+    }
+
+    const auto &labelItem = caseBlock->getCaseLabelItems().front();
+    if (labelItem.getGuardExpr() && !labelItem.isDefault()) {
+      TC.diagnose(labelItem.getStartLoc(), diag::unknown_case_where_clause)
+          .highlight(labelItem.getGuardExpr()->getSourceRange());
+    }
+
+    const Pattern *pattern =
+        labelItem.getPattern()->getSemanticsProvidingPattern();
+    if (!isa<AnyPattern>(pattern)) {
+      TC.diagnose(labelItem.getStartLoc(), diag::unknown_case_must_be_catchall)
+          .highlight(pattern->getSourceRange());
+    }
+  }
+
+  void checkFallthroughPatternBindingsAndTypes(CaseStmt *caseBlock,
+                                               CaseStmt *previousBlock) {
+    auto firstPattern = caseBlock->getCaseLabelItems()[0].getPattern();
+    SmallVector<VarDecl *, 4> vars;
+    firstPattern->collectVariables(vars);
+
+    for (auto &labelItem : previousBlock->getCaseLabelItems()) {
+      const Pattern *pattern = labelItem.getPattern();
+      SmallVector<VarDecl *, 4> PreviousVars;
+      pattern->collectVariables(PreviousVars);
+      for (auto expected : vars) {
+        bool matched = false;
+        if (!expected->hasName())
+          continue;
+        for (auto previous : PreviousVars) {
+          if (previous->hasName() &&
+              expected->getName() == previous->getName()) {
+            if (!previous->getType()->isEqual(expected->getType())) {
+              TC.diagnose(previous->getLoc(),
+                          diag::type_mismatch_fallthrough_pattern_list,
+                          previous->getType(), expected->getType());
+              previous->markInvalid();
+              expected->markInvalid();
+            }
+            matched = true;
+            break;
+          }
+        }
+        if (!matched) {
+          TC.diagnose(PreviousFallthrough->getLoc(),
+                      diag::fallthrough_into_case_with_var_binding,
+                      expected->getName());
+        }
+      }
+    }
+  }
+
+  Stmt *visitSwitchStmt(SwitchStmt *switchStmt) {
     // Type-check the subject expression.
-    Expr *subjectExpr = S->getSubjectExpr();
+    Expr *subjectExpr = switchStmt->getSubjectExpr();
     auto resultTy = TC.typeCheckExpression(subjectExpr, DC);
     auto limitExhaustivityChecks = !resultTy;
     if (Expr *newSubjectExpr = TC.coerceToRValue(subjectExpr))
       subjectExpr = newSubjectExpr;
-    S->setSubjectExpr(subjectExpr);
-    Type subjectType = S->getSubjectExpr()->getType();
+    switchStmt->setSubjectExpr(subjectExpr);
+    Type subjectType = switchStmt->getSubjectExpr()->getType();
 
     // Type-check the case blocks.
     AddSwitchNest switchNest(*this);
-    AddLabeledStmt labelNest(*this, S);
+    AddLabeledStmt labelNest(*this, switchStmt);
 
     // Pre-emptively visit all Decls (#if/#warning/#error) that still exist in
     // the list of raw cases.
-    for (auto node : S->getRawCases()) {
-      if (!node.is<Decl*>()) continue;
-      TC.typeCheckDecl(node.get<Decl*>());
+    for (auto &node : switchStmt->getRawCases()) {
+      if (!node.is<Decl *>())
+        continue;
+      TC.typeCheckDecl(node.get<Decl *>());
     }
 
-    auto cases = S->getCases();
+    auto cases = switchStmt->getCases();
     CaseStmt *previousBlock = nullptr;
     for (auto i = cases.begin(), e = cases.end(); i != e; ++i) {
       auto *caseBlock = *i;
@@ -978,138 +1115,21 @@
       FallthroughDest = std::next(i) == e ? nullptr : *std::next(i);
 
       for (auto &labelItem : caseBlock->getMutableCaseLabelItems()) {
-        // Resolve the pattern in the label.
-        Pattern *pattern = labelItem.getPattern();
-        if (auto *newPattern = TC.resolvePattern(pattern, DC,
-                                                 /*isStmtCondition*/false)) {
-          pattern = newPattern;
-          // Coerce the pattern to the subject's type.
-          TypeResolutionOptions patternOptions(TypeResolverContext::InExpression);
-          if (!subjectType ||
-              TC.coercePatternToType(pattern, TypeResolution::forContextual(DC),
-                                     subjectType, patternOptions)) {
-            limitExhaustivityChecks = true;
-
-            // If that failed, mark any variables binding pieces of the pattern
-            // as invalid to silence follow-on errors.
-            pattern->forEachVariable([&](VarDecl *VD) {
-              VD->markInvalid();
-            });
-          }
-          labelItem.setPattern(pattern);
-          
-          // For each variable in the pattern, make sure its type is identical to what it
-          // was in the first label item's pattern.
-          auto firstPattern = caseBlock->getCaseLabelItems()[0].getPattern();
-          SmallVector<VarDecl *, 4> vars;
-          firstPattern->collectVariables(vars);
-          pattern->forEachVariable([&](VarDecl *VD) {
-            if (!VD->hasName())
-              return;
-            for (auto *expected : vars) {
-              if (expected->hasName() && expected->getName() == VD->getName()) {
-                if (VD->hasType() && expected->hasType() && !expected->isInvalid() &&
-                    !VD->getType()->isEqual(expected->getType())) {
-                  TC.diagnose(VD->getLoc(), diag::type_mismatch_multiple_pattern_list,
-                              VD->getType(), expected->getType());
-                  VD->markInvalid();
-                  expected->markInvalid();
-                }
-                if (expected->isLet() != VD->isLet()) {
-                  auto diag = TC.diagnose(VD->getLoc(),
-                                          diag::mutability_mismatch_multiple_pattern_list,
-                                          VD->isLet(), expected->isLet());
-
-                  VarPattern *foundVP = nullptr;
-                  VD->getParentPattern()->forEachNode([&](Pattern *P) {
-                    if (auto *VP = dyn_cast<VarPattern>(P))
-                      if (VP->getSingleVar() == VD)
-                        foundVP = VP;
-                  });
-                  if (foundVP)
-                    diag.fixItReplace(foundVP->getLoc(),
-                                      expected->isLet() ? "let" : "var");
-                  VD->markInvalid();
-                  expected->markInvalid();
-                }
-                return;
-              }
-            }
-          });
-        }
-        // Check the guard expression, if present.
-        if (auto *guard = labelItem.getGuardExpr()) {
-          limitExhaustivityChecks |= TC.typeCheckCondition(guard, DC);
-          labelItem.setGuardExpr(guard);
-        }
+        // Resolve the pattern in our case label if it has not been resolved
+        // and check that our var decls follow invariants.
+        checkCaseLabelItem(caseBlock, labelItem, limitExhaustivityChecks,
+                           subjectType);
       }
 
       // Check restrictions on '@unknown'.
       if (caseBlock->hasUnknownAttr()) {
-        if (caseBlock->getCaseLabelItems().size() != 1) {
-          assert(!caseBlock->getCaseLabelItems().empty() &&
-                 "parser should not produce case blocks with no items");
-          TC.diagnose(caseBlock->getLoc(),
-                      diag::unknown_case_multiple_patterns)
-            .highlight(caseBlock->getCaseLabelItems()[1].getSourceRange());
-          limitExhaustivityChecks = true;
-        }
-
-        if (FallthroughDest != nullptr) {
-          if (!caseBlock->isDefault())
-            TC.diagnose(caseBlock->getLoc(), diag::unknown_case_must_be_last);
-          limitExhaustivityChecks = true;
-        }
-
-        const CaseLabelItem &labelItem = caseBlock->getCaseLabelItems().front();
-        if (labelItem.getGuardExpr() && !labelItem.isDefault()) {
-          TC.diagnose(labelItem.getStartLoc(),
-                      diag::unknown_case_where_clause)
-            .highlight(labelItem.getGuardExpr()->getSourceRange());
-        }
-
-        const Pattern *pattern =
-            labelItem.getPattern()->getSemanticsProvidingPattern();
-        if (!isa<AnyPattern>(pattern)) {
-          TC.diagnose(labelItem.getStartLoc(),
-                      diag::unknown_case_must_be_catchall)
-            .highlight(pattern->getSourceRange());
-        }
+        checkUnknownAttrRestrictions(caseBlock, limitExhaustivityChecks);
       }
 
       // If the previous case fellthrough, similarly check that that case's bindings
       // includes our first label item's pattern bindings and types.
       if (PreviousFallthrough && previousBlock) {
-        auto firstPattern = caseBlock->getCaseLabelItems()[0].getPattern();
-        SmallVector<VarDecl *, 4> Vars;
-        firstPattern->collectVariables(Vars);
-
-        for (auto &labelItem : previousBlock->getCaseLabelItems()) {
-          const Pattern *pattern = labelItem.getPattern();
-          SmallVector<VarDecl *, 4> PreviousVars;
-          pattern->collectVariables(PreviousVars);
-          for (auto expected : Vars) {
-            bool matched = false;
-            if (!expected->hasName())
-              continue;
-            for (auto previous: PreviousVars) {
-              if (previous->hasName() && expected->getName() == previous->getName()) {
-                if (!previous->getType()->isEqual(expected->getType())) {
-                  TC.diagnose(previous->getLoc(), diag::type_mismatch_fallthrough_pattern_list,
-                              previous->getType(), expected->getType());
-                  previous->markInvalid();
-                  expected->markInvalid();
-                }
-                matched = true;
-                break;
-              }
-            }
-            if (!matched) {
-              TC.diagnose(PreviousFallthrough->getLoc(),
-                          diag::fallthrough_into_case_with_var_binding, expected->getName());
-            }
-          }
-        }
+        checkFallthroughPatternBindingsAndTypes(caseBlock, previousBlock);
       }
       
       // Type-check the body statements.
@@ -1120,11 +1140,11 @@
       previousBlock = caseBlock;
     }
 
-    if (!S->isImplicit()) {
-      TC.checkSwitchExhaustiveness(S, DC, limitExhaustivityChecks);
+    if (!switchStmt->isImplicit()) {
+      TC.checkSwitchExhaustiveness(switchStmt, DC, limitExhaustivityChecks);
     }
 
-    return S;
+    return switchStmt;
   }
 
   Stmt *visitCaseStmt(CaseStmt *S) {
diff --git a/lib/Sema/TypeCheckType.cpp b/lib/Sema/TypeCheckType.cpp
index 9cece60..07a79ce 100644
--- a/lib/Sema/TypeCheckType.cpp
+++ b/lib/Sema/TypeCheckType.cpp
@@ -1057,10 +1057,23 @@
       NominalTypeDecl *nominal = nullptr;
       if ((nominalDC = dc->getInnermostTypeContext()) &&
           (nominal = nominalDC->getSelfNominalTypeDecl())) {
-        // Attempt to refer to 'Self' within a non-protocol nominal
-        // type. Fix this by replacing 'Self' with the nominal type name.
         assert(!isa<ProtocolDecl>(nominal) && "Cannot be a protocol");
 
+        bool insideClass = nominalDC->getSelfClassDecl() != nullptr;
+        AbstractFunctionDecl *methodDecl = dc->getInnermostMethodContext();
+        bool declaringMethod = methodDecl &&
+          methodDecl->getDeclContext() == dc->getParentForLookup();
+
+        if (((!insideClass || !declaringMethod) &&
+             !options.is(TypeResolverContext::GenericRequirement)) ||
+            options.is(TypeResolverContext::ExplicitCastExpr)) {
+          Type SelfType = nominal->getSelfInterfaceType();
+          if (insideClass)
+            SelfType = DynamicSelfType::get(SelfType, ctx);
+          return resolution.mapTypeIntoContext(SelfType);
+        }
+
+        // Attempt to refer to 'Self' within a non-protocol nominal type.
         // Produce a Fix-It replacing 'Self' with the nominal type name.
         auto name = getDeclNameFromContext(dc, nominal);
         diags.diagnose(comp->getIdLoc(), diag::self_in_nominal, name)
diff --git a/stdlib/public/Darwin/Foundation/NSDictionary.swift b/stdlib/public/Darwin/Foundation/NSDictionary.swift
index 90be2e4..08bf302 100644
--- a/stdlib/public/Darwin/Foundation/NSDictionary.swift
+++ b/stdlib/public/Darwin/Foundation/NSDictionary.swift
@@ -136,7 +136,7 @@
     to: T.Type
   ) {
     for i in (0..<count).reversed() {
-      let bridged = Swift._forceBridgeFromObjectiveC(buffer[i], T.self)
+      let bridged = buffer[i] as! T
       _bridgeInitialize(index: i, of: buffer, to: bridged)
     }
   }
@@ -222,11 +222,9 @@
     if keyStride < objectStride || valueStride < objectStride {
       var builder = _DictionaryBuilder<Key, Value>(count: d.count)
       d.enumerateKeysAndObjects({ (anyKey: Any, anyValue: Any, _) in
-        let anyObjectKey = anyKey as AnyObject
-        let anyObjectValue = anyValue as AnyObject
         builder.add(
-            key: Swift._forceBridgeFromObjectiveC(anyObjectKey, Key.self),
-            value: Swift._forceBridgeFromObjectiveC(anyObjectValue, Value.self))
+          key: anyKey as! Key,
+          value: anyValue as! Value)
       })
       result = builder.take()
     } else {
diff --git a/stdlib/public/Darwin/Foundation/NSSet.swift b/stdlib/public/Darwin/Foundation/NSSet.swift
index 0ad4f77..e571475 100644
--- a/stdlib/public/Darwin/Foundation/NSSet.swift
+++ b/stdlib/public/Darwin/Foundation/NSSet.swift
@@ -77,10 +77,8 @@
       // Swift. See rdar://problem/35995647
       var set = Set(minimumCapacity: s.count)
       s.enumerateObjects({ (anyMember: Any, _) in
-        let member = Swift._forceBridgeFromObjectiveC(
-          anyMember as AnyObject, Element.self)
         // FIXME: Log a warning if `member` is already in the set.
-        set.insert(member)
+        set.insert(anyMember as! Element)
       })
       result = set
       return
@@ -90,8 +88,7 @@
     // an NSSet.
     var builder = _SetBuilder<Element>(count: s.count)
     s.enumerateObjects({ (anyMember: Any, _) in
-      builder.add(member: Swift._forceBridgeFromObjectiveC(
-        anyMember as AnyObject, Element.self))
+      builder.add(member: anyMember as! Element)
     })
     result = builder.take()
   }
diff --git a/stdlib/public/SwiftOnoneSupport/CMakeLists.txt b/stdlib/public/SwiftOnoneSupport/CMakeLists.txt
index 4121d97..efb94ba 100644
--- a/stdlib/public/SwiftOnoneSupport/CMakeLists.txt
+++ b/stdlib/public/SwiftOnoneSupport/CMakeLists.txt
@@ -9,7 +9,7 @@
   SWIFT_COMPILE_FLAGS "-parse-stdlib" "-Xllvm" "-sil-inline-generics=false" "-Xfrontend" "-validate-tbd-against-ir=none" "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}"
   LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
   INSTALL_IN_COMPONENT stdlib)
-if(CMAKE_BUILD_TYPE STREQUAL Debug AND WINDOWS IN_LIST SWIFT_SDKS)
+if(WINDOWS IN_LIST SWIFT_SDKS)
   # When building in Debug mode, the standard library provides the symbols that
   # we need and as such SwiftOnoneSupport does not need to provide any exported
   # interfaces.  This results in the import library beinging elided.  However,
diff --git a/stdlib/public/Windows/WinSDK.swift b/stdlib/public/Windows/WinSDK.swift
index f20497a..50cf642 100644
--- a/stdlib/public/Windows/WinSDK.swift
+++ b/stdlib/public/Windows/WinSDK.swift
@@ -71,3 +71,17 @@
 public let TRACKBAR_CLASSW: [WCHAR] = Array<WCHAR>("msctls_trackbar32".utf16)
 public let UPDOWN_CLASSW: [WCHAR] = Array<WCHAR>("msctls_updown32".utf16)
 
+// Swift Convenience
+public extension FILETIME {
+  var time_t: time_t {
+    let NTTime: Int64 = Int64(self.dwLowDateTime) | (Int64(self.dwHighDateTime) << 32)
+    return (NTTime - 116444736000000000) / 10000000
+  }
+
+  init(from time: time_t) {
+    let UNIXTime: Int64 = ((time * 10000000) + 116444736000000000)
+    self = FILETIME(dwLowDateTime: DWORD(UNIXTime & 0xffffffff),
+                    dwHighDateTime: DWORD((UNIXTime >> 32) & 0xffffffff))
+  }
+}
+
diff --git a/stdlib/public/runtime/Casting.cpp b/stdlib/public/runtime/Casting.cpp
index e91c239..39390c2 100644
--- a/stdlib/public/runtime/Casting.cpp
+++ b/stdlib/public/runtime/Casting.cpp
@@ -3023,14 +3023,17 @@
         const_cast<void*>(swift_dynamicCastUnknownClass(sourceValue,
                                                         objectiveCType));
       
-    if (sourceValueAsObjectiveCType) {
-      // The type matches.  _forceBridgeFromObjectiveC returns `Self`, so
-      // we can just return it directly.
-      bridgeWitness->forceBridgeFromObjectiveC(
-        static_cast<HeapObject*>(sourceValueAsObjectiveCType),
-        destValue, nativeType, nativeType, bridgeWitness);
-      return;
+    if (!sourceValueAsObjectiveCType) {
+      swift::swift_dynamicCastFailure(_swift_getClass(sourceValue),
+                                      objectiveCType);
     }
+
+    // The type matches.  _forceBridgeFromObjectiveC returns `Self`, so
+    // we can just return it directly.
+    bridgeWitness->forceBridgeFromObjectiveC(
+      static_cast<HeapObject*>(sourceValueAsObjectiveCType),
+      destValue, nativeType, nativeType, bridgeWitness);
+    return;
   }
   
   // Fail.
diff --git a/stdlib/public/runtime/SwiftObject.h b/stdlib/public/runtime/SwiftObject.h
index a730d51..1688f02 100644
--- a/stdlib/public/runtime/SwiftObject.h
+++ b/stdlib/public/runtime/SwiftObject.h
@@ -30,13 +30,9 @@
 
 #if SWIFT_OBJC_INTEROP
 
-#if SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
 // Source code: "SwiftObject"
 // Real class name: mangled "Swift._SwiftObject"
 #define SwiftObject _TtCs12_SwiftObject
-#else
-// Pre-stable ABI uses un-mangled name for SwiftObject
-#endif
 
 #if __has_attribute(objc_root_class)
 __attribute__((__objc_root_class__))
diff --git a/test/IDE/complete_constrained.swift b/test/IDE/complete_constrained.swift
index 4fb0e34..3922d3f 100644
--- a/test/IDE/complete_constrained.swift
+++ b/test/IDE/complete_constrained.swift
@@ -1,5 +1,8 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=MYSTRUCT_INT_DOT | %FileCheck %s -check-prefix=MYSTRUCT_INT_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=META_MYSTRUCT_INT_DOT | %FileCheck %s -check-prefix=META_MYSTRUCT_INT_DOT
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITIONAL_OVERLOAD_ARG | %FileCheck %s -check-prefix=CONDITIONAL_OVERLOAD_ARG
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITIONAL_OVERLOAD_INIT_ARG | %FileCheck %s -check-prefix=CONDITIONAL_OVERLOAD_ARG
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITIONAL_INAPPLICABLE_ARG | %FileCheck %s -check-prefix=CONDITIONAL_INAPPLICABLE_ARG
 
 protocol SomeProto {
   associatedtype Assoc
@@ -70,3 +73,44 @@
 // META_MYSTRUCT_INT_DOT-DAG: Decl[InstanceMethod]/Super:         protoExt_None_AssocEqInt({#(self): MyStruct<Int>#})[#(U) -> Int#]; name=protoExt_None_AssocEqInt(self: MyStruct<Int>)
 // META_MYSTRUCT_INT_DOT: End completions
 }
+
+//https://bugs.swift.org/browse/SR-9938
+enum Fruit     { case apple }
+enum Vegetable { case broccoli }
+enum Meat      { case chicken }
+
+protocol EatsFruit      { }
+protocol EatsVegetables { }
+protocol EatsMeat       { }
+
+struct Chef <Client> { }
+
+extension Chef where Client: EatsFruit {
+  init(_ favorite: Fruit) {}
+  func cook(_ food: Fruit) { }
+}
+extension Chef where Client: EatsVegetables {
+  init(_ favorite: Vegetable) {}
+  func cook(_ food: Vegetable) { }
+}
+extension Chef where Client: EatsMeat {
+  init(favorite: Meat) {}
+  func cook(_ food: Meat) { }
+  func eat(_ food: Meat) {}
+}
+
+struct Vegetarian: EatsFruit, EatsVegetables { }
+
+func testVegetarian(chef: Chef<Vegetarian>) {
+  chef.cook(.#^CONDITIONAL_OVERLOAD_ARG^#)
+// CONDITIONAL_OVERLOAD_ARG: Begin completions, 2 items
+// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/ExprSpecific:     apple[#Fruit#]; name=apple
+// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/ExprSpecific:     broccoli[#Vegetable#]; name=broccoli
+// CONDITIONAL_OVERLOAD_ARG: End completions
+
+  var chefMeta: Chef<Vegetarian>.Type = Chef<Vegetarian>.self
+  let _ = chefMeta.init(.#^CONDITIONAL_OVERLOAD_INIT_ARG^#)
+
+  chef.eat(.#^CONDITIONAL_INAPPLICABLE_ARG^#)
+// CONDITIONAL_INAPPLICABLE_ARG-NOT: Begin completion
+}
diff --git a/test/IDE/complete_value_expr.swift b/test/IDE/complete_value_expr.swift
index e4fbe8d..804c965 100644
--- a/test/IDE/complete_value_expr.swift
+++ b/test/IDE/complete_value_expr.swift
@@ -150,6 +150,7 @@
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_2
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_3 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_3
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_4 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_4
+// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_INIT_5 | %FileCheck %s -check-prefix=PROTOCOL_EXT_INIT_5
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_DOT_2 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_DOT
 // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT_P4_T_DOT_1 | %FileCheck %s -check-prefix=PROTOCOL_EXT_P4_T_DOT_1
@@ -1815,11 +1816,15 @@
   S(#^PROTOCOL_EXT_INIT_2^#
   S.#^PROTOCOL_EXT_INIT_3^#
   S#^PROTOCOL_EXT_INIT_4^#
+
+  var sTy: S.Type = S.self
+  sTy.init(#^PROTOCOL_EXT_INIT_5^#
 }
 
 // PROTOCOL_EXT_INIT_2: Decl[Constructor]/CurrNominal: ['(']{#x: Int#}[')'][#P4#]{{; name=.+$}}
 // PROTOCOL_EXT_INIT_3: Decl[Constructor]/CurrNominal: init({#x: Int#})[#P4#]{{; name=.+$}}
 // PROTOCOL_EXT_INIT_4: Decl[Constructor]/CurrNominal: ({#x: Int#})[#P4#]{{; name=.+$}}
+// PROTOCOL_EXT_INIT_5: Pattern/CurrModule:            ['(']{#x: Int#}[')'][#S#]{{; name=.+$}}
 
 extension P4 where Self.T == OnlyMe {
   final func test1() {
diff --git a/test/Interpreter/SDK/Inputs/OldABI/OldABI.mm b/test/Interpreter/SDK/Inputs/OldABI/OldABI.mm
index 81f235b..98d561c 100644
--- a/test/Interpreter/SDK/Inputs/OldABI/OldABI.mm
+++ b/test/Interpreter/SDK/Inputs/OldABI/OldABI.mm
@@ -158,8 +158,8 @@
 
 bool CanTestOldABI() {
   // These tests don't work until the stable ABI is using its designed bit.
-  // This check can be removed after SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT
-  // is set everywhere.
+  // This check can be removed after SWIFT_CLASS_IS_SWIFT_MASK is made
+  // static everywhere.
   Class cls = objc_getClass("_TtCs19__EmptyArrayStorage");
   if (!cls) abort();
   uintptr_t *words = (uintptr_t *)cls;
diff --git a/test/ParseableInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface b/test/ParseableInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface
index f26ddc8..5f99502 100644
--- a/test/ParseableInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface
+++ b/test/ParseableInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface
@@ -2,7 +2,7 @@
 // swift-module-flags: -module-name ObjCAttrWithoutFoundation -enable-library-evolution -enable-objc-interop
 
 // RUN: %empty-directory(%t)
-// RUN: echo 'import ObjCAttrWithoutFoundation' | %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t -I %S -
+// RUN: echo 'import ObjCAttrWithoutFoundation' | %target-swift-frontend -typecheck -module-cache-path %t -I %S -
 
 public class MyClass {
   public init()
diff --git a/test/ParseableInterface/ModuleCache/SerializedSIL.swiftinterface b/test/ParseableInterface/ModuleCache/SerializedSIL.swiftinterface
index c529fe8..50f88c0 100644
--- a/test/ParseableInterface/ModuleCache/SerializedSIL.swiftinterface
+++ b/test/ParseableInterface/ModuleCache/SerializedSIL.swiftinterface
@@ -2,7 +2,7 @@
 // swift-module-flags: -module-name SerializedSIL -enable-library-evolution
 
 // RUN: %empty-directory(%t)
-// RUN: echo 'import SerializedSIL' | %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t -I %S -
+// RUN: echo 'import SerializedSIL' | %target-swift-frontend -typecheck -module-cache-path %t -I %S -
 // RUN: %target-sil-opt -disable-sil-linking %t/SerializedSIL-*.swiftmodule -module-name SerializedSIL > %t/SerializedSIL.sil
 // RUN: %FileCheck %s < %t/SerializedSIL.sil
 // RUN: %FileCheck -check-prefix NEGATIVE %s < %t/SerializedSIL.sil
diff --git a/test/ParseableInterface/ModuleCache/WrongName.swiftinterface b/test/ParseableInterface/ModuleCache/WrongName.swiftinterface
index 70b2724..3423aa2 100644
--- a/test/ParseableInterface/ModuleCache/WrongName.swiftinterface
+++ b/test/ParseableInterface/ModuleCache/WrongName.swiftinterface
@@ -2,6 +2,6 @@
 // swift-module-flags: -module-name DreadPirateRoberts
 
 // RUN: %empty-directory(%t)
-// RUN: echo 'import WrongName' | not %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t -I %S - 2>&1 | %FileCheck %s
+// RUN: echo 'import WrongName' | not %target-swift-frontend -typecheck -module-cache-path %t -I %S - 2>&1 | %FileCheck %s
 
 // CHECK: :1:8: error: cannot load module 'DreadPirateRoberts' as 'WrongName'
diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift b/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift
index 62e4259..6c0fc8b 100644
--- a/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift
+++ b/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift
@@ -16,7 +16,7 @@
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
 // (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // 3. Only module is present.
 // RUN: %empty-directory(%t/Lib.swiftmodule)
@@ -53,7 +53,7 @@
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
 // (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // 6. Both are present but the module can't be opened.
 // RUN: chmod a-r %t/Lib.swiftmodule/%target-swiftmodule-name
diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift b/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift
index 5905fa4..9badfa3 100644
--- a/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift
+++ b/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift
@@ -16,7 +16,7 @@
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
 // (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // 3. Only module is present.
 // RUN: %empty-directory(%t/Lib.framework/Modules/Lib.swiftmodule)
@@ -53,7 +53,7 @@
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -F %t 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
 // RUN: %empty-directory(%t/MCP)
 // (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -F %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 // RUN: %empty-directory(%t/MCP)
 
 // 6. Both are present but the module can't be opened.
diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode.swift b/test/ParseableInterface/ModuleCache/force-module-loading-mode.swift
index 3111364..54bb4cc 100644
--- a/test/ParseableInterface/ModuleCache/force-module-loading-mode.swift
+++ b/test/ParseableInterface/ModuleCache/force-module-loading-mode.swift
@@ -14,7 +14,7 @@
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %S/Inputs/force-module-loading-mode/ 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %S/Inputs/force-module-loading-mode/ 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
 // (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %S/Inputs/force-module-loading-mode/ %s 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %S/Inputs/force-module-loading-mode/ %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // 3. Only module is present.
 // RUN: sed -e 's/FromInterface/FromSerialized/g' %S/Inputs/force-module-loading-mode/Lib.swiftinterface | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/Lib.swiftmodule - -module-name Lib
@@ -50,7 +50,7 @@
 // RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
 // RUN: %empty-directory(%t/MCP)
 // (default)
-// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 // RUN: %empty-directory(%t/MCP)
 
 // 6. Both are present but the module can't be opened.
diff --git a/test/ParseableInterface/ModuleCache/module-cache-bad-version.swift b/test/ParseableInterface/ModuleCache/module-cache-bad-version.swift
index 8e7441a..475b3c5 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-bad-version.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-bad-version.swift
@@ -16,7 +16,7 @@
 //
 // Try to build TestModule into a .swiftmodule explicitly using LeafModule via LeafModule.swiftinterface, but fail because version mismatch in LeafModule.swiftinterface.
 //
-// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module  -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/err.txt 2>&1
+// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module  -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/err.txt 2>&1
 // RUN: test ! -f %t/TestModule.swiftmodule
 // RUN: test ! -f %t/modulecache/LeafModule-*.swiftmodule
 // RUN: %FileCheck %s -check-prefix=CHECK-ERR <%t/err.txt
diff --git a/test/ParseableInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift b/test/ParseableInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift
index e52ae4e..b338a08 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift
@@ -16,11 +16,11 @@
 //
 // Phase 2: build OtherModule into a .swiftinterface file with -target x86_64-macosx-10.10:
 //
-// RUN: %swift -target x86_64-apple-macosx10.10 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -enable-parseable-module-interface -typecheck
+// RUN: %swift -target x86_64-apple-macosx10.10 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -typecheck
 //
 // Phase 3: build TestModule in -target x86_64-apple-macosx10.11 and import both of these:
 //
-// RUN: %swift -target x86_64-apple-macosx10.11  -I %t -module-cache-path %t/modulecache -module-name TestModule %s -enable-parseable-module-interface -typecheck
+// RUN: %swift -target x86_64-apple-macosx10.11  -I %t -module-cache-path %t/modulecache -module-name TestModule %s -typecheck
 //
 // Phase 4: make sure we only compiled LeafModule and OtherModule one time:
 //
diff --git a/test/ParseableInterface/ModuleCache/module-cache-diagnostics.swift b/test/ParseableInterface/ModuleCache/module-cache-diagnostics.swift
index a7a7606..46681bc 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-diagnostics.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-diagnostics.swift
@@ -23,9 +23,9 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift
 // RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule
 //
 //
@@ -38,7 +38,7 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/LeafModule.swiftinterface
 // RUN: rm %t/TestModule.swiftmodule
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/warn.txt 2>&1
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/warn.txt 2>&1
 // RUN: %{python} %S/Inputs/check-is-new.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // "check warn.txt exists and is empty"
 // RUN: test -e %t/warn.txt -a ! -s %t/warn.txt
@@ -53,7 +53,7 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/LeafModule.swiftinterface
 // RUN: rm %t/TestModule.swiftmodule
-// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/err.txt 2>&1
+// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/err.txt 2>&1
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // RUN: %FileCheck %s -check-prefix=CHECK-ERROR <%t/err.txt
 // CHECK-ERROR: LeafModule.swiftinterface:7:8: error: no such module 'NotAModule'
@@ -64,7 +64,7 @@
 //
 // RUN: %{python} %S/Inputs/check-is-old.py %t/OtherModule.swiftinterface %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
-// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -serialize-diagnostics -serialize-diagnostics-path %t/err.dia -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -serialize-diagnostics -serialize-diagnostics-path %t/err.dia -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // RUN: c-index-test -read-diagnostics %t/err.dia 2>&1 | %FileCheck %s -check-prefix=CHECK-ERROR
 //
@@ -76,7 +76,7 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/OtherModule.swiftinterface %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
-// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/err-inline.txt 2>&1
+// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s >%t/err-inline.txt 2>&1
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // RUN: %FileCheck %s -check-prefix=CHECK-ERROR-INLINE <%t/err-inline.txt
 // CHECK-ERROR-INLINE: LeafModule.swiftinterface:6:33: error: use of unresolved identifier 'unresolved'
@@ -87,7 +87,7 @@
 //
 // RUN: %{python} %S/Inputs/check-is-old.py %t/OtherModule.swiftinterface %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
-// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -serialize-diagnostics -serialize-diagnostics-path %t/err-inline.dia -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: not %target-swift-frontend -I %t -module-cache-path %t/modulecache -serialize-diagnostics -serialize-diagnostics-path %t/err-inline.dia -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // RUN: c-index-test -read-diagnostics %t/err-inline.dia 2>&1 | %FileCheck %s -check-prefix=CHECK-ERROR-INLINE
 
diff --git a/test/ParseableInterface/ModuleCache/module-cache-effective-version-irrelevant.swift b/test/ParseableInterface/ModuleCache/module-cache-effective-version-irrelevant.swift
index e61b819..f86e9cd 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-effective-version-irrelevant.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-effective-version-irrelevant.swift
@@ -13,11 +13,11 @@
 //
 // Phase 2: build OtherModule into a .swiftinterface file with -swift-version 4.2:
 //
-// RUN: %target-swift-frontend -swift-version 4.2 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -enable-parseable-module-interface -typecheck
+// RUN: %target-swift-frontend -swift-version 4.2 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -typecheck
 //
 // Phase 3: build TestModule in -swift-version 5 and import both of these:
 //
-// RUN: %target-swift-frontend -swift-version 5 -I %t -module-cache-path %t/modulecache -module-name TestModule %s -enable-parseable-module-interface -typecheck
+// RUN: %target-swift-frontend -swift-version 5 -I %t -module-cache-path %t/modulecache -module-name TestModule %s -typecheck
 //
 // Phase 4: make sure we only compiled LeafModule and OtherModule one time:
 //
diff --git a/test/ParseableInterface/ModuleCache/module-cache-errors-in-importing-file.swift b/test/ParseableInterface/ModuleCache/module-cache-errors-in-importing-file.swift
index 2aa7c3c..2d149f9 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-errors-in-importing-file.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-errors-in-importing-file.swift
@@ -14,7 +14,7 @@
 
 // Actual test: compile and verify the import succeeds (i.e. we only report the error in this file)
 //
-// RUN: %target-swift-frontend -typecheck -verify -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface %s
+// RUN: %target-swift-frontend -typecheck -verify -I %t -module-cache-path %t/modulecache %s
 
 unresolved // expected-error {{use of unresolved identifier 'unresolved'}}
 
diff --git a/test/ParseableInterface/ModuleCache/module-cache-init.swift b/test/ParseableInterface/ModuleCache/module-cache-init.swift
index dc296ff..7012efe 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-init.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-init.swift
@@ -17,7 +17,7 @@
 //
 // Phase 2: build OtherModule into a .swiftinterface _using_ LeafModule via LeafModule.swiftinterface, creating LeafModule-*.swiftmodule along the way.
 //
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
 // RUN: test -f %t/OtherModule.swiftinterface
 // RUN: %FileCheck %s -check-prefix=CHECK-OTHERINTERFACE <%t/OtherModule.swiftinterface
 // CHECK-OTHERINTERFACE: OtherFunc
@@ -31,7 +31,7 @@
 //
 // Phase 3: build TestModule into a .swiftmodule explicitly us OtherModule via OtherModule.swiftinterface, creating OtherModule-*.swiftmodule along the way.
 //
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -emit-dependencies -emit-dependencies-path %t/TestModule.d -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -emit-dependencies -emit-dependencies-path %t/TestModule.d -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: test -f %t/TestModule.swiftmodule
 // RUN: test -f %t/modulecache/OtherModule-*.swiftmodule
 // RUN: test -f %t/TestModule.d
diff --git a/test/ParseableInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift b/test/ParseableInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift
index c8b44fd..11725ab 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift
@@ -21,9 +21,9 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift
 // RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule
 //
 //
@@ -33,7 +33,7 @@
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // RUN: touch %t/OtherModule.swiftinterface
 // RUN: rm %t/TestModule.swiftmodule
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/check-is-new.py %t/modulecache/OtherModule-*.swiftmodule
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/LeafModule-*.swiftmodule
 
diff --git a/test/ParseableInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift b/test/ParseableInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift
index 04a1307..9e52d7d 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift
@@ -20,9 +20,9 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift
 // RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule
 //
 //
@@ -34,7 +34,7 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/OtherModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/OtherModule.swiftinterface
 // RUN: rm %t/TestModule.swiftmodule
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/check-is-new.py %t/modulecache/OtherModule-*.swiftmodule
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/LeafModule-*.swiftmodule
 
diff --git a/test/ParseableInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift b/test/ParseableInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift
index a0595bc..f429a34 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift
@@ -21,9 +21,9 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift
 // RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule
 //
 //
@@ -33,7 +33,7 @@
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // RUN: touch %t/LeafModule.swiftinterface
 // RUN: rm %t/TestModule.swiftmodule
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/check-is-new.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 
 import OtherModule
diff --git a/test/ParseableInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift b/test/ParseableInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift
index fe7814f..fa2aba0 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift
@@ -20,9 +20,9 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift
 // RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule
 //
 //
@@ -34,7 +34,7 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/LeafModule.swiftinterface
 // RUN: rm %t/TestModule.swiftmodule
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/check-is-new.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 
 import OtherModule
diff --git a/test/ParseableInterface/ModuleCache/module-cache-no-rebuild.swift b/test/ParseableInterface/ModuleCache/module-cache-no-rebuild.swift
index c26bb9c..2e40b91 100644
--- a/test/ParseableInterface/ModuleCache/module-cache-no-rebuild.swift
+++ b/test/ParseableInterface/ModuleCache/module-cache-no-rebuild.swift
@@ -20,9 +20,9 @@
 // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift
 // RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule
 //
 //
@@ -31,7 +31,7 @@
 // RUN: %{python} %S/Inputs/check-is-old.py %t/OtherModule.swiftinterface %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 // RUN: rm %t/TestModule.swiftmodule
-// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -enable-parseable-module-interface -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
+// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s
 // RUN: %{python} %S/Inputs/check-is-old.py %t/OtherModule.swiftinterface %t/LeafModule.swiftinterface
 // RUN: %{python} %S/Inputs/check-is-old.py %t/modulecache/OtherModule-*.swiftmodule %t/modulecache/LeafModule-*.swiftmodule
 
diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift
index 3072831..13523cf 100644
--- a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift
+++ b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift
@@ -4,29 +4,29 @@
 
 // Baseline check: if the prebuilt cache path does not exist, everything should
 // still work.
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // Baseline check: if the module is not in the prebuilt cache, build it
 // normally.
 // RUN: %empty-directory(%t/prebuilt-cache)
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // Do a manual prebuild, and see if it gets picked up.
 // RUN: %empty-directory(%t/MCP)
 // RUN: %empty-directory(%t/prebuilt-cache/Lib.swiftmodule)
 // RUN: sed -e 's/FromInterface/FromPrebuilt/g' %S/Inputs/prebuilt-module-cache/Lib.swiftinterface | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/prebuilt-cache/Lib.swiftmodule/%target-swiftmodule-name - -module-name Lib
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
 
 // Make sure we installed a forwarding module.
 // RUN: %{python} %S/Inputs/check-is-forwarding-module.py %t/MCP/Lib-*.swiftmodule
 
 // What if the module is invalid?
 // RUN: rm %t/prebuilt-cache/Lib.swiftmodule/%target-swiftmodule-name && touch %t/prebuilt-cache/Lib.swiftmodule/%target-swiftmodule-name
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // What if the arch is missing?
 // RUN: rm %t/prebuilt-cache/Lib.swiftmodule/%target-swiftmodule-name
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %t/include -I %t/include/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 import Lib
 
diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift
index 06ffcfd..a400ef0 100644
--- a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift
+++ b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift
@@ -7,24 +7,24 @@
 // RUN: %target-swift-frontend -build-module-from-parseable-interface -module-cache-path %t/MCP -serialize-parseable-module-interface-dependency-hashes -o %t/prebuilt-cache/Lib.swiftmodule %t/Lib.swiftinterface
 
 // Next, use the module and check if the forwarding module is in place.
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
 
 // Make sure we installed a forwarding module.
 // RUN: %{python} %S/Inputs/check-is-forwarding-module.py %t/MCP/Lib-*.swiftmodule
 
 // Now invalidate a dependency of the prebuilt module, and make sure the forwarding file is replaced with a real module.
 // RUN: touch %t/Lib.swiftinterface
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // Delete the cached module we just created, and create the forwarding module again
 // RUN: %empty-directory(%t/MCP)
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
 
 // Move the prebuilt module out of the way, so the forwarding module points to nothing.
 // RUN: mv %t/prebuilt-cache/Lib.swiftmodule %t/prebuilt-cache/NotLib.swiftmodule
 
 // Make sure we delete the existing forwarding module and rebuild from an interface.
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // Move the prebuilt module back to its original path
 // RUN: mv %t/prebuilt-cache/NotLib.swiftmodule %t/prebuilt-cache/Lib.swiftmodule
@@ -32,10 +32,10 @@
 // If the forwarding module is corrupted, we shouldn't rebuild the module in the cache,
 // we should delete it and generate a new forwarding module.
 // RUN: %empty-directory(%t/MCP)
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1
 // RUN: %{python} %S/Inputs/check-is-forwarding-module.py %t/MCP/Lib-*.swiftmodule
 // RUN: chmod a-r %t/MCP/Lib-*.swiftmodule
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
 // RUN: %{python} %S/Inputs/check-is-forwarding-module.py %t/MCP/Lib-*.swiftmodule
 
 import Lib
diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-recursive.swift b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-recursive.swift
index 17a303e..f063679 100644
--- a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-recursive.swift
+++ b/test/ParseableInterface/ModuleCache/prebuilt-module-cache-recursive.swift
@@ -3,19 +3,19 @@
 // Baseline check: if the module is not in the prebuilt cache, build it
 // normally.
 // RUN: %empty-directory(%t/prebuilt-cache)
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // Do a manual prebuild, and see if it gets picked up.
 // RUN: %empty-directory(%t/MCP)
 // RUN: sed -e 's/FromInterface/FromPrebuilt/g' %S/Inputs/prebuilt-module-cache/Lib.swiftinterface | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/prebuilt-cache/Lib.swiftmodule - -module-name Lib
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
 
 // Make sure we installed a forwarding module.
 // RUN: %{python} %S/Inputs/check-is-forwarding-module.py %t/MCP/Lib-*.swiftmodule
 
 // What if the module is invalid?
 // RUN: rm %t/prebuilt-cache/Lib.swiftmodule && touch %t/prebuilt-cache/Lib.swiftmodule
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/ -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/ -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 import LibExporter
 
diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache.swift b/test/ParseableInterface/ModuleCache/prebuilt-module-cache.swift
index dd23403..2a440ed 100644
--- a/test/ParseableInterface/ModuleCache/prebuilt-module-cache.swift
+++ b/test/ParseableInterface/ModuleCache/prebuilt-module-cache.swift
@@ -2,34 +2,34 @@
 
 // Baseline check: if the prebuilt cache path does not exist, everything should
 // still work.
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // Baseline check: if the module is not in the prebuilt cache, build it
 // normally.
 // RUN: %empty-directory(%t/prebuilt-cache)
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // Do a manual prebuild, and see if it gets picked up.
 // RUN: %empty-directory(%t/MCP)
 // RUN: sed -e 's/FromInterface/FromPrebuilt/g' %S/Inputs/prebuilt-module-cache/Lib.swiftinterface | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/prebuilt-cache/Lib.swiftmodule - -module-name Lib
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
 
 // Make sure we installed a forwarding module.
 // RUN: %{python} %S/Inputs/check-is-forwarding-module.py %t/MCP/Lib-*.swiftmodule
 
 // Try some variations on the detection that the search path is in the SDK:
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S//Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/prebuilt-module-cache -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk / -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S//Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/prebuilt-module-cache -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk / -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s
 
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/p -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/garbage-path -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk "" -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/p -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/garbage-path -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk "" -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 // What if the module is invalid?
 // RUN: rm %t/prebuilt-cache/Lib.swiftmodule && touch %t/prebuilt-cache/Lib.swiftmodule
-// RUN: not %target-swift-frontend -typecheck -enable-parseable-module-interface -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/ -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
+// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs/ -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
 
 import Lib
 
diff --git a/test/ParseableInterface/linking-to-module.swift b/test/ParseableInterface/linking-to-module.swift
index 0605210..3d79f2a 100644
--- a/test/ParseableInterface/linking-to-module.swift
+++ b/test/ParseableInterface/linking-to-module.swift
@@ -1,7 +1,7 @@
 // RUN: %empty-directory(%t)
 
 // RUN: %target-build-swift -emit-library -module-name TestModule -module-link-name coreTestModuleKitUtilsTool %S/Inputs/TestModule.swift -emit-parseable-module-interface -o %t/%target-library-name(coreTestModuleKitUtilsTool)
-// RUN: %target-swift-frontend -emit-ir -I %t -L %t -enable-parseable-module-interface %s | %FileCheck %s
+// RUN: %target-swift-frontend -emit-ir -I %t -L %t %s | %FileCheck %s
 
 import TestModule
 
diff --git a/test/ParseableInterface/stored-properties-client.swift b/test/ParseableInterface/stored-properties-client.swift
index 15d2cde..d739e88 100644
--- a/test/ParseableInterface/stored-properties-client.swift
+++ b/test/ParseableInterface/stored-properties-client.swift
@@ -1,10 +1,10 @@
 // RUN: %empty-directory(%t)
 
 // RUN: %target-swift-frontend -typecheck %S/stored-properties.swift -module-name StoredProperties -emit-parseable-module-interface-path %t/StoredProperties.swiftinterface
-// RUN: %target-swift-frontend -emit-ir %s -I %t -enable-parseable-module-interface | %FileCheck %s -check-prefix CHECK -check-prefix COMMON
+// RUN: %target-swift-frontend -emit-ir %s -I %t | %FileCheck %s -check-prefix CHECK -check-prefix COMMON
 
 // RUN: %target-swift-frontend -typecheck %S/stored-properties.swift -enable-library-evolution -module-name StoredProperties -emit-parseable-module-interface-path %t/StoredProperties.swiftinterface
-// RUN: %target-swift-frontend -emit-ir %s -I %t -enable-parseable-module-interface | %FileCheck %s -check-prefix RESILIENT -check-prefix COMMON
+// RUN: %target-swift-frontend -emit-ir %s -I %t | %FileCheck %s -check-prefix RESILIENT -check-prefix COMMON
 
 // REQUIRES: rdar_46486517
 
diff --git a/test/SILOptimizer/prespecialize.swift b/test/SILOptimizer/prespecialize.swift
index d195911..c1d13e9 100644
--- a/test/SILOptimizer/prespecialize.swift
+++ b/test/SILOptimizer/prespecialize.swift
@@ -1,5 +1,8 @@
 // RUN: %target-swift-frontend  %s -Onone -Xllvm -sil-inline-generics=false -emit-sil | %FileCheck %s
 
+// This is disabled for now.
+// REQUIRES: rdar48924409
+
 // REQUIRES: optimized_stdlib
 
 // Check that pre-specialization works at -Onone.
diff --git a/test/Serialization/resilience.swift b/test/Serialization/resilience.swift
index b7b3b1e..ad81aef 100644
--- a/test/Serialization/resilience.swift
+++ b/test/Serialization/resilience.swift
@@ -1,7 +1,7 @@
 // RUN: %empty-directory(%t)
 
-// This test checks that we serialize the -enable-library-evolution and -sil-serialize-all
-// flags correctly.
+// This test checks that we serialize the -enable-library-evolution
+// flag.
 
 // RUN: %target-swift-frontend -emit-module -o %t %s
 // RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience.dump.txt
@@ -10,11 +10,13 @@
 // RUN: %target-swift-frontend -emit-module -o %t -enable-library-evolution %s
 // RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience2.dump.txt
 // RUN: %FileCheck -check-prefix=CHECK -check-prefix=RESILIENCE %s < %t/resilience2.dump.txt
+// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/resilience2.dump.txt
 
-// RUN: %target-swift-frontend -emit-module -o %t %s
-// RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience3.dump.txt
-// RUN: %FileCheck -check-prefix=CHECK -check-prefix=FRAGILE %s < %t/resilience3.dump.txt
+// FIXME: The alternate -enable-resilience flag is going away soon.
 
+// RUN: %target-swift-frontend -emit-module -o %t -enable-resilience %s
+// RUN: llvm-bcanalyzer -dump %t/resilience.swiftmodule > %t/resilience2.dump.txt
+// RUN: %FileCheck -check-prefix=CHECK -check-prefix=RESILIENCE %s < %t/resilience2.dump.txt
 // RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/resilience2.dump.txt
 
 // CHECK: <MODULE_BLOCK {{.*}}>
diff --git a/test/SourceKit/CodeComplete/complete_swiftinterface.swift b/test/SourceKit/CodeComplete/complete_swiftinterface.swift
index 26d9642..4e8a988 100644
--- a/test/SourceKit/CodeComplete/complete_swiftinterface.swift
+++ b/test/SourceKit/CodeComplete/complete_swiftinterface.swift
@@ -3,7 +3,7 @@
 
 // 1) Build .swiftinterface files for MyPoint and MyExtensions, using a non-default module cache path
 // RUN: %target-swift-frontend -emit-parseable-module-interface-path %t/MyPoint.swiftinterface -module-name MyPoint -emit-module -o /dev/null %S/Inputs/parseable-interface/MyPoint.swift
-// RUN: %target-swift-frontend -emit-parseable-module-interface-path %t/MyPointExtensions.swiftinterface -module-name MyPointExtensions -emit-module -o /dev/null -enable-parseable-module-interface -module-cache-path %t/modulecache -I %t %S/Inputs/parseable-interface/MyPointExtensions.swift
+// RUN: %target-swift-frontend -emit-parseable-module-interface-path %t/MyPointExtensions.swiftinterface -module-name MyPointExtensions -emit-module -o /dev/null -module-cache-path %t/modulecache -I %t %S/Inputs/parseable-interface/MyPointExtensions.swift
 // RUN: %empty-directory(%t/modulecache)
 
 // 2) Check completion using the default (cold) module cache
diff --git a/test/SourceKit/InterfaceGen/gen_swift_module.swift b/test/SourceKit/InterfaceGen/gen_swift_module.swift
index 0df2fee..054672f 100644
--- a/test/SourceKit/InterfaceGen/gen_swift_module.swift
+++ b/test/SourceKit/InterfaceGen/gen_swift_module.swift
@@ -30,5 +30,5 @@
 
 // RUN: %empty-directory(%t.mod)
 // RUN: %swift -emit-module -o /dev/null -emit-parseable-module-interface-path %t.mod/swift_mod.swiftinterface %S/Inputs/swift_mod.swift -parse-as-library
-// RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod -enable-parseable-module-interface -module-cache-path %t/mcp > %t.response
+// RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod -module-cache-path %t/mcp > %t.response
 // RUN: diff -u %s.from_swiftinterface.response %t.response
diff --git a/test/decl/func/dynamic_self.swift b/test/decl/func/dynamic_self.swift
index 89c380b..c76ef45 100644
--- a/test/decl/func/dynamic_self.swift
+++ b/test/decl/func/dynamic_self.swift
@@ -10,15 +10,15 @@
 }
 
 struct S0 {
-  func f() -> Self { } // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'S0'?}}{{15-19=S0}}
+  func f() -> Self { }
 
-  func g(_ ds: Self) { } // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'S0'?}}{{16-20=S0}}
+  func g(_ ds: Self) { }
 }
 
 enum E0 {
-  func f() -> Self { } // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'E0'?}}{{15-19=E0}}
+  func f() -> Self { }
 
-  func g(_ ds: Self) { } // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'E0'?}}{{16-20=E0}}
+  func g(_ ds: Self) { }
 }
 
 class C0 {
@@ -85,11 +85,11 @@
     var x: Int = self // expected-error{{cannot convert value of type 'Self.Type' to specified type 'Int'}}
 
     // Can't utter Self within the body of a method.
-    var c1 = C1(int: 5) as Self // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'C1'?}} {{28-32=C1}}
+    var c1 = C1(int: 5) as Self // expected-error{{'C1' is not convertible to 'Self'; did you mean to use 'as!' to force downcast?}}
 
     if b { return self.init(int: 5) }
 
-    return Self() // expected-error{{use of unresolved identifier 'Self'; did you mean 'self'?}}
+    return Self() // expected-error{{non-nominal type 'Self' does not support explicit initialization}}
   }
 
   // This used to crash because metatype construction went down a
@@ -412,4 +412,4 @@
 func useSelfOperator() {
   let s = SelfOperator()
   _ = s + s
-}
\ No newline at end of file
+}
diff --git a/test/decl/nested/type_in_type.swift b/test/decl/nested/type_in_type.swift
index 6543b11..6945639 100644
--- a/test/decl/nested/type_in_type.swift
+++ b/test/decl/nested/type_in_type.swift
@@ -417,7 +417,6 @@
   }
 
   func doMoreStuffWrong() -> Self {
-    // expected-error@-1 {{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'OuterGeneric.MidNonGeneric'?}}
 
   }
 }
diff --git a/test/stdlib/Inputs/SwiftObjectNSObject/SwiftObjectNSObject.m b/test/stdlib/Inputs/SwiftObjectNSObject/SwiftObjectNSObject.m
index 7193815..dc97c42 100644
--- a/test/stdlib/Inputs/SwiftObjectNSObject/SwiftObjectNSObject.m
+++ b/test/stdlib/Inputs/SwiftObjectNSObject/SwiftObjectNSObject.m
@@ -74,12 +74,6 @@
 {
     SwiftObjectDemangledName = "Swift._SwiftObject";
     Class cls = objc_getClass(SwiftObjectDemangledName);
-    // FIXME: Remove this fallback after we enable
-    // SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT everywhere.
-    if (!cls) {
-        SwiftObjectDemangledName = "SwiftObject";
-        cls = objc_getClass(SwiftObjectDemangledName);
-    }
 
     class_addMethod(cls, @selector(perform0), (IMP)Perform0, "@@:");
     class_addMethod(cls, @selector(perform1:), (IMP)Perform1, "@@:@");
diff --git a/test/type/self.swift b/test/type/self.swift
index 8158429..0a9fea9 100644
--- a/test/type/self.swift
+++ b/test/type/self.swift
@@ -1,7 +1,7 @@
 // RUN: %target-typecheck-verify-swift -swift-version 5
 
 struct S0<T> {
-  func foo(_ other: Self) { } // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'S0'?}}{{21-25=S0}}
+  func foo(_ other: Self) { }
 }
 
 class C0<T> {
@@ -9,7 +9,7 @@
 }
 
 enum E0<T> {
-  func foo(_ other: Self) { } // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'E0'?}}{{21-25=E0}}
+  func foo(_ other: Self) { }
 }
 
 // rdar://problem/21745221
@@ -23,7 +23,7 @@
 }
 
 extension X.Inner {
-  func foo(_ other: Self) { } // expected-error{{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'X.Inner'?}}{{21-25=X.Inner}}
+  func foo(_ other: Self) { }
 }
 
 // SR-695
@@ -43,3 +43,111 @@
     }
 }
 
+// These references to Self are now possible (SE-0068)
+
+class A<T> {
+  let b: Int
+  required init(a: Int) {
+    print("\(Self.self).\(#function)")
+    Self.y()
+    b = a
+  }
+  static func z(n: Self? = nil) {
+    // expected-error@-1 {{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'A'?}}
+    print("\(Self.self).\(#function)")
+  }
+  class func y() {
+    print("\(Self.self).\(#function)")
+    Self.z()
+  }
+  func x() -> A? {
+    print("\(Self.self).\(#function)")
+    Self.y()
+    Self.z()
+    let _: Self = Self.init(a: 66)
+    // expected-error@-1 {{'Self' is only available in a protocol or as the result of a method in a class; did you mean 'A'?}}
+    return Self.init(a: 77) as? Self as? A
+    // expected-warning@-1 {{conditional cast from 'Self' to 'Self' always succeeds}}
+    // expected-warning@-2 {{conditional downcast from 'Self?' to 'A<T>' is equivalent to an implicit conversion to an optional 'A<T>'}}
+  }
+}
+
+class B: A<Int> {
+  let a: Int
+  required convenience init(a: Int) {
+    print("\(Self.self).\(#function)")
+    self.init()
+  }
+  init() {
+    print("\(Self.self).\(#function)")
+    Self.y()
+    Self.z()
+    a = 99
+    super.init(a: 88)
+  }
+  override class func y() {
+    print("override \(Self.self).\(#function)")
+  }
+}
+
+class C {
+  required init() {
+  }
+  func f() {
+    func g(_: Self) {}
+  }
+  func g() {
+    _ = Self.init() as? Self
+    // expected-warning@-1 {{conditional cast from 'Self' to 'Self' always succeeds}}
+  }
+}
+
+struct S2 {
+  let x = 99
+  struct S3<T> {
+    let x = 99
+    static func x() {
+      Self.y()
+    }
+    func f() {
+      func g(_: Self) {}
+    }
+    static func y() {
+      print("HERE")
+    }
+    func foo(a: [Self]) -> Self? {
+      Self.x()
+      return Self.init() as? Self
+      // expected-warning@-1 {{conditional cast from 'S2.S3<T>' to 'S2.S3<T>' always succeeds}}
+    }
+  }
+}
+
+extension S2 {
+  static func x() {
+    Self.y()
+  }
+  static func y() {
+    print("HERE")
+  }
+  func f() {
+    func g(_: Self) {}
+  }
+  func foo(a: [Self]) -> Self? {
+    Self.x()
+    return Self.init() as? Self
+    // expected-warning@-1 {{conditional cast from 'S2' to 'S2' always succeeds}}
+  }
+}
+
+enum E {
+  static func f() {
+    func g(_: Self) {}
+    print("f()")
+  }
+  case e
+  func h(h: Self) -> Self {
+    Self.f()
+    return .e
+  }
+}
diff --git a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp
index 4b7a735..72ee213 100644
--- a/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp
+++ b/tools/SourceKit/lib/SwiftLang/SwiftEditorInterfaceGen.cpp
@@ -708,7 +708,6 @@
   }
 
   Invocation.getClangImporterOptions().ImportForwardDeclarations = true;
-  Invocation.getFrontendOptions().EnableParseableModuleInterface = true;
 
   std::string ErrMsg;
   auto IFaceGenRef = SwiftInterfaceGenContext::create(Name,
diff --git a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp
index cb63406..1d50d59 100644
--- a/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp
+++ b/tools/SourceKit/lib/SwiftLang/SwiftLangSupport.cpp
@@ -859,6 +859,7 @@
 
   DWORD success = GetFinalPathNameByHandleA(
       fileHandle, full_path, sizeof(full_path), FILE_NAME_NORMALIZED);
+  CloseHandle(fileHandle);
   return (success ? full_path : InputPath);
 #endif
 }
diff --git a/tools/swift-ide-test/swift-ide-test.cpp b/tools/swift-ide-test/swift-ide-test.cpp
index 93f52c5..4571c27 100644
--- a/tools/swift-ide-test/swift-ide-test.cpp
+++ b/tools/swift-ide-test/swift-ide-test.cpp
@@ -268,12 +268,6 @@
 ModuleCachePath("module-cache-path", llvm::cl::desc("Clang module cache path"),
                 llvm::cl::cat(Category));
 
-static llvm::cl::opt<bool>
-EnableParseableModuleInterface("enable-parseable-module-interface",
-           llvm::cl::desc("Enable loading .swiftinterface files when available"),
-           llvm::cl::cat(Category),
-           llvm::cl::init(true));
-
 static llvm::cl::opt<std::string>
 PCHOutputDir("pch-output-dir",
              llvm::cl::desc("place autogenerated PCH files in this directory"),
@@ -3272,8 +3266,6 @@
         InitInvok.getLangOptions().EffectiveLanguageVersion = actual.getValue();
     }
   }
-  InitInvok.getFrontendOptions().EnableParseableModuleInterface =
-    options::EnableParseableModuleInterface;
   InitInvok.getClangImporterOptions().ModuleCachePath =
     options::ModuleCachePath;
   InitInvok.getClangImporterOptions().PrecompiledHeaderOutputDir =
diff --git a/validation-test/stdlib/DictionaryTrapsObjC.swift b/validation-test/stdlib/DictionaryTrapsObjC.swift
index 93cf6f4..31f8736 100644
--- a/validation-test/stdlib/DictionaryTrapsObjC.swift
+++ b/validation-test/stdlib/DictionaryTrapsObjC.swift
@@ -147,6 +147,142 @@
   nsd.mutableCopy()
 }
 
+DictionaryTraps.test("ForcedNonverbatimBridge.StringKey")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+  let d1: NSDictionary = [
+    "Gordon" as NSString: NSObject(),
+    "William" as NSString: NSObject(),
+    "Katherine" as NSString: NSObject(),
+    "Lynn" as NSString: NSObject(),
+    "Brian" as NSString: NSObject(),
+    1756 as NSNumber: NSObject()]
+
+  expectCrashLater()
+  _ = d1 as! Dictionary<String, Any>
+}
+
+DictionaryTraps.test("ForcedNonverbatimBridge.IntKey")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+
+  let d1: NSDictionary = [
+    4 as NSNumber: NSObject(),
+    8 as NSNumber: NSObject(),
+    15 as NSNumber: NSObject(),
+    16 as NSNumber: NSObject(),
+    23 as NSNumber: NSObject(),
+    42 as NSNumber: NSObject(),
+    "John" as NSString: NSObject()]
+
+  expectCrashLater()
+  _ = d1 as! Dictionary<Int, Any>
+}
+
+DictionaryTraps.test("ForcedNonverbatimBridge.Value")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+
+  let d1: NSDictionary = [
+    4 as NSNumber: "Jack" as NSString,
+    8 as NSNumber: "Kate" as NSString,
+    15 as NSNumber: "Hurley" as NSString,
+    16 as NSNumber: "Sawyer" as NSString,
+    23 as NSNumber: "John" as NSString,
+    42 as NSNumber: NSObject()]
+
+  expectCrashLater()
+  _ = d1 as! Dictionary<NSObject, String>
+}
+
+
+DictionaryTraps.test("ForcedVerbatimBridge.StringKey")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+  let d1: NSDictionary = [
+    "Gordon" as NSString: NSObject(),
+    "William" as NSString: NSObject(),
+    "Katherine" as NSString: NSObject(),
+    "Lynn" as NSString: NSObject(),
+    "Brian" as NSString: NSObject(),
+    1756 as NSNumber: NSObject()]
+
+  // With the ObjC runtime, the verbatim downcast is O(1); it performs no
+  // runtime checks.
+  let d2 = d1 as! Dictionary<NSString, NSObject>
+  // Element access goes through the bridged path and performs forced downcasts.
+  // This is where the odd numeric value is caught.
+  expectCrashLater()
+  for (key, value) in d2 {
+    _ = (key, value)
+  }
+}
+
+DictionaryTraps.test("ForcedVerbatimBridge.IntKey")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+
+  let d1: NSDictionary = [
+    4 as NSNumber: NSObject(),
+    8 as NSNumber: NSObject(),
+    15 as NSNumber: NSObject(),
+    16 as NSNumber: NSObject(),
+    23 as NSNumber: NSObject(),
+    42 as NSNumber: NSObject(),
+    "John" as NSString: NSObject()]
+
+  // With the ObjC runtime, the verbatim downcast is O(1); it performs no
+  // runtime checks.
+  let d2 = d1 as! Dictionary<NSNumber, NSObject>
+  // Element access goes through the bridged path and performs forced downcasts.
+  // This is where the odd numeric value is caught.
+  expectCrashLater()
+  for (key, value) in d2 {
+    _ = (key, value)
+  }
+}
+
+DictionaryTraps.test("ForcedVerbatimBridge.Value")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+
+  let d1: NSDictionary = [
+    4 as NSNumber: "Jack" as NSString,
+    8 as NSNumber: "Kate" as NSString,
+    15 as NSNumber: "Hurley" as NSString,
+    16 as NSNumber: "Sawyer" as NSString,
+    23 as NSNumber: "John" as NSString,
+    42 as NSNumber: NSObject()]
+
+  // With the ObjC runtime, the verbatim downcast is O(1); it performs no
+  // runtime checks.
+  let d2 = d1 as! Dictionary<NSObject, NSString>
+  // Element access goes through the bridged path and performs forced downcasts.
+  // This is where the odd numeric value is caught.
+  expectCrashLater()
+  for (key, value) in d2 {
+    _ = (key, value)
+  }
+}
+
 DictionaryTraps.test("Downcast1") {
   let d: Dictionary<NSObject, NSObject> = [ TestObjCKeyTy(10): NSObject(),
                                             NSObject() : NSObject() ]
diff --git a/validation-test/stdlib/Set.swift b/validation-test/stdlib/Set.swift
index a6de928..5d641ce 100644
--- a/validation-test/stdlib/Set.swift
+++ b/validation-test/stdlib/Set.swift
@@ -4613,4 +4613,102 @@
   s.remove(at: i)
 }
 
+#if _runtime(_ObjC)
+SetTestSuite.test("ForcedNonverbatimBridge.Trap.String")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+
+  let s1: NSSet = [
+    "Gordon" as NSString,
+    "William" as NSString,
+    "Katherine" as NSString,
+    "Lynn" as NSString,
+    "Brian" as NSString,
+    1756 as NSNumber]
+
+  expectCrashLater()
+  _ = s1 as! Set<String>
+}
+#endif
+
+#if _runtime(_ObjC)
+SetTestSuite.test("ForcedNonverbatimBridge.Trap.Int")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+
+  let s1: NSSet = [
+    4 as NSNumber,
+    8 as NSNumber,
+    15 as NSNumber,
+    16 as NSNumber,
+    23 as NSNumber,
+    42 as NSNumber,
+    "John" as NSString]
+
+  expectCrashLater()
+  _ = s1 as! Set<Int>
+}
+#endif
+
+#if _runtime(_ObjC)
+SetTestSuite.test("ForcedVerbatimBridge.Trap.NSString")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+
+  let s1: NSSet = [
+    "Gordon" as NSString,
+    "William" as NSString,
+    "Katherine" as NSString,
+    "Lynn" as NSString,
+    "Brian" as NSString,
+    1756 as NSNumber]
+
+  // With the ObjC runtime, the verbatim downcast is O(1); it performs no
+  // runtime checks.
+  let s2 = s1 as! Set<NSString>
+  // Element access goes through the bridged path and performs forced downcasts.
+  // This is where the odd numeric value is caught.
+  expectCrashLater()
+  for string in s2 {
+    _ = string
+  }
+}
+#endif
+
+#if _runtime(_ObjC)
+SetTestSuite.test("ForcedVerbatimBridge.Trap.NSNumber")
+  .skip(.custom(
+    { _isFastAssertConfiguration() },
+    reason: "this trap is not guaranteed to happen in -Ounchecked"))
+  .crashOutputMatches("Could not cast value of type")
+  .code {
+  let s1: NSSet = [
+    4 as NSNumber,
+    8 as NSNumber,
+    15 as NSNumber,
+    16 as NSNumber,
+    23 as NSNumber,
+    42 as NSNumber,
+    "John" as NSString]
+  // With the ObjC runtime, the verbatim downcast is O(1); it performs no
+  // runtime checks.
+  let s2 = s1 as! Set<NSNumber>
+  // Element access goes through the bridged path and performs forced downcasts.
+  // This is where the odd numeric value is caught.
+  expectCrashLater()
+  for string in s2 {
+    _ = string
+  }
+}
+#endif
+
 runAllTests()