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 {
2654
2654
if (!var->hasInterfaceType ())
2655
2655
return ;
2656
2656
2657
+ // The types for imported vars are produced lazily and
2658
+ // could fail to import.
2659
+ if (var->getClangDecl () && var->isInvalid ())
2660
+ return ;
2661
+
2657
2662
PrettyStackTraceDecl debugStack (" verifying VarDecl" , var);
2658
2663
2659
2664
// Variables must have materializable type.
Original file line number Diff line number Diff line change @@ -6510,7 +6510,7 @@ Type ClangImporter::importVarDeclType(
6510
6510
getImportTypeAttrs (decl));
6511
6511
6512
6512
if (!importedType)
6513
- return nullptr ;
6513
+ return ErrorType::get (Impl. SwiftContext ) ;
6514
6514
6515
6515
if (importedType.isImplicitlyUnwrapped ())
6516
6516
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