mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix SR-5614, add check if importType succeds (#11698)
SwiftDeclConverter::importSwiftNewtype now check if the storedUnderlyingType is null and return a nullptr
This commit is contained in:
committed by
Jordan Rose
parent
1e69d14f95
commit
a598277ad3
@@ -4970,6 +4970,9 @@ SwiftDeclConverter::importSwiftNewtype(const clang::TypedefNameDecl *decl,
|
||||
decl->getUnderlyingType(), ImportTypeKind::Value, isInSystemModule(dc),
|
||||
Bridgeability::None, OTK_None);
|
||||
|
||||
if (!storedUnderlyingType)
|
||||
return nullptr;
|
||||
|
||||
if (auto objTy = storedUnderlyingType->getAnyOptionalObjectType())
|
||||
storedUnderlyingType = objTy;
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
@import Foundation;
|
||||
|
||||
typedef NSString MyString __attribute__((swift_wrapper(struct)));
|
||||
extern MyString * const MyStringOne;
|
||||
4
test/ClangImporter/bad-ns-extensible-string-enum.swift
Normal file
4
test/ClangImporter/bad-ns-extensible-string-enum.swift
Normal file
@@ -0,0 +1,4 @@
|
||||
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -import-objc-header %S/Inputs/bad-ns-extensible-string-enum.h -verify
|
||||
// REQUIRES: objc_interop
|
||||
|
||||
let string = MyString.MyStringOne // expected-error {{use of unresolved identifier 'MyString'}}
|
||||
Reference in New Issue
Block a user