File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -2654,6 +2654,11 @@ class Verifier : public ASTWalker {
26542654 if (!var->hasInterfaceType ())
26552655 return ;
26562656
2657+ // The types for imported vars are produced lazily and
2658+ // could fail to import.
2659+ if (var->getClangDecl () && var->isInvalid ())
2660+ return ;
2661+
26572662 PrettyStackTraceDecl debugStack (" verifying VarDecl" , var);
26582663
26592664 // Variables must have materializable type.
Original file line number Diff line number Diff line change @@ -6510,7 +6510,7 @@ Type ClangImporter::importVarDeclType(
65106510 getImportTypeAttrs (decl));
65116511
65126512 if (!importedType)
6513- return nullptr ;
6513+ return ErrorType::get (Impl. SwiftContext ) ;
65146514
65156515 if (importedType.isImplicitlyUnwrapped ())
65166516 swiftDecl->setImplicitlyUnwrappedOptional (true );
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t/src)
2+ // RUN: split-file %s %t/src
3+
4+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %t/src/main.swift \
5+ // RUN: -import-objc-header %t/src/Test.h \
6+ // RUN: -module-name main -I %t -verify
7+
8+ // REQUIRES: objc_interop
9+
10+ //--- Test.h
11+ @import Foundation;
12+
13+ extern const unsigned char TestDir[ ] ;
14+
15+ extern NSString * _Nonnull __TestDir __attribute__( ( swift_name ( " TestDir " ) ) ) ;
16+
17+ //--- main.swift
18+ import Foundation
19+
20+ func test( ) {
21+ print ( TestDir)
22+ }
You can’t perform that action at this time.
0 commit comments