Skip to content

Fix the TypeChecker's omitNeedlessWords to use interface types. #7212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jrose-apple
Copy link
Contributor

  • Explanation: Like Use interface types when checking #keyPath. (#7028) #7043, near-miss checking for protocol requirements was accessing the AST in a way that's no longer supported. This commit changes it to use the new API.
  • Scope: Affects near-miss checking for protocol requirements. The crash occurred when the requirement was in an @objc protocol in an imported Swift module (as opposed to an imported Objective-C module or the Swift module currently being compiled).
  • Issue: SR-3618 / SR-3812 / rdar://problem/30323021
  • Reviewed by: @slavapestov, @DougGregor
  • Risk: Very low. There should be no visible behavior change from this.
  • Testing: Added compiler regression tests, verified that the developer-submitted test cases no longer hit this issue.

…tlang#7193)

...avoiding a crash when trying to detect near misses of protocol
requirements. Unfortunately I can't come up with a test case for the
VarDecl changes; everything I try seems to already work. But using
interface types is more correct anyway.

https://bugs.swift.org/browse/SR-3812
@jrose-apple jrose-apple added this to the Swift 3.1 milestone Feb 2, 2017
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 2, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - ab59425
Test requested by - @jrose-apple

@shahmishal
Copy link
Member

14:44:19 FAILED: stdlib/public/SDK/CoreImage/iphoneos/armv7/CoreImage.o 
14:44:19 cd /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/buildbot_incremental/swift-macosx-x86_64/stdlib/public/SDK/CoreImage && /usr/bin/python /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/swift/utils/line-directive /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/swift/stdlib/public/SDK/CoreImage/CoreImage.swift -- /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/buildbot_incremental/swift-macosx-x86_64/./bin/swiftc -c -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk -target armv7-apple-ios7.0 -resource-dir /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/buildbot_incremental/swift-macosx-x86_64/./lib/swift -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/../../../Developer/Library/Frameworks -O -D INTERNAL_CHECKS_ENABLED -I /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/buildbot_incremental/swift-macosx-x86_64/./lib/swift/iphoneos/armv7 -module-cache-path /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/buildbot_incremental/swift-macosx-x86_64/./module-cache -no-link-objc-runtime -Xfrontend -sil-verify-all -autolink-force-load -module-link-name swiftCoreImage -force-single-frontend-invocation -parse-as-library -o /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/buildbot_incremental/swift-macosx-x86_64/stdlib/public/SDK/CoreImage/iphoneos/armv7/CoreImage.o /Users/buildnode/jenkins/workspace/swift-PR-osx/branch-swift-3.1-branch/swift/stdlib/public/SDK/CoreImage/CoreImage.swift
14:44:19 0  swift                    0x000000010aa907c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
14:44:19 1  swift                    0x000000010aa90e76 SignalHandler(int) + 454
14:44:19 2  libsystem_platform.dylib 0x00007fff99a51bba _sigtramp + 26
14:44:19 3  swift                    0x0000000108081097 (anonymous namespace)::ItaniumRecordLayoutBuilder::~ItaniumRecordLayoutBuilder() + 823
14:44:19 4  swift                    0x00000001080427d3 clang::ExternalASTSource::ASTSourceDescriptor::ASTSourceDescriptor(clang::Module const&) + 163
14:44:19 5  swift                    0x0000000109f1ce1b clang::ASTReader::getSourceDescriptor(unsigned int) + 107
14:44:19 6  swift                    0x0000000109f1cf62 non-virtual thunk to clang::ASTReader::getSourceDescriptor(unsigned int) + 18
14:44:19 7  swift                    0x0000000107cbbedd clang::CodeGen::CGDebugInfo::getParentModuleOrNull(clang::Decl const*) + 189
14:44:19 8  swift                    0x0000000107cc5bd9 clang::CodeGen::CGDebugInfo::CreateType(clang::ObjCInterfaceType const*, llvm::DIFile*) + 681
14:44:19 9  swift                    0x0000000107cbc51d clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) + 93
14:44:19 10 swift                    0x0000000107cbed65 clang::CodeGen::CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag, clang::Type const*, clang::QualType, llvm::DIFile*) + 245
14:44:19 11 swift                    0x0000000107cbc51d clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*) + 93
14:44:19 12 swift                    0x0000000107cc77f9 clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::ObjCInterfaceType const*, llvm::DIFile*)::$_0::operator()(clang::ObjCPropertyDecl const*) const + 633
14:44:19 13 swift                    0x0000000107cc63d9 clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::ObjCInterfaceType const*, llvm::DIFile*) + 1737
14:44:19 14 swift                    0x0000000107cd07f5 clang::CodeGen::CGDebugInfo::finalize() + 181
14:44:19 15 swift                    0x0000000107e09bfd clang::CodeGen::CodeGenModule::Release() + 1837
14:44:19 16 swift                    0x0000000107e91de6 (anonymous namespace)::PCHContainerGenerator::HandleTranslationUnit(clang::ASTContext&) + 422
14:44:19 17 swift                    0x0000000109dd2d0c clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 44
14:44:19 18 swift                    0x000000010a003e22 clang::ParseAST(clang::Sema&, bool, bool) + 578
14:44:19 19 swift                    0x0000000109d9a9e9 clang::FrontendAction::Execute() + 73
14:44:19 20 swift                    0x0000000109d64241 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1137
14:44:19 21 swift                    0x000000010aa2392e llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 222
14:44:19 22 swift                    0x000000010aa23ab0 RunSafelyOnThread_Dispatch(void*) + 48
14:44:19 23 swift                    0x000000010aa91ead ExecuteOnThread_Dispatch(void*) + 13
14:44:19 24 libsystem_pthread.dylib  0x00007fff99a5baab _pthread_body + 180
14:44:19 25 libsystem_pthread.dylib  0x00007fff99a5b9f7 _pthread_body + 0
14:44:19 26 libsystem_pthread.dylib  0x00007fff99a5b1fd thread_start + 13

@jrose-apple
Copy link
Contributor Author

Tagging in @bcardosolopes again. We're seeing a disturbing number of these...

@bcardosolopes
Copy link
Contributor

@jrose-apple first time I see this one. Is there a way to reproduce this one directly with clang? i.e., can you help me getting an easy way to reproduce?

@jrose-apple
Copy link
Contributor Author

I have no idea. As far as I know no one sees these locally, and I don't know if they're reproducible, but over the past week or two there's been a much higher incidence rate of failures in ASTReader and ASTWriter, even for clean builds with fresh module caches.

(It's possible no one sees this locally because no one does clean builds locally.)

@bcardosolopes
Copy link
Contributor

@jrose-apple any chance that CI can re-try/re-stress this on top of 658ce8b57dff0720013241d5d6a301e084fdbb68 instead? Finding the culprit commit (if any) in the recent changes would be a start

@jrose-apple
Copy link
Contributor Author

Can you make (but not merge) a PR containing the reverts, and then we can test it? I don't think this PR is related, and I'd still like to get it into Swift 3.1, so we can go test there.

Oh, I also remembered "please test" isn't actually a clean build by default. Maybe that's related here.

@slavapestov
Copy link
Contributor

LGTM

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test macOS

@tkremenek tkremenek merged commit d751c87 into swiftlang:swift-3.1-branch Feb 4, 2017
@jrose-apple jrose-apple deleted the 3.1-omit-needless-types branch February 4, 2017 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants