Skip to content
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

[SR-9007] Assertion failure in swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::TypeResolution, swift::TypeResolutionOptions, bool) #51510

Closed
nathawes opened this issue Oct 16, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@nathawes
Copy link
Collaborator

Previous ID SR-9007
Radar rdar://problem/45289643
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 2dee2d5dccc78eaed2f91999ad53e39d

duplicates:

  • SR-8984 Compiler crash: swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type)

Issue Description:

Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/include/llvm/Support/Casting.h, line 106.

To reproduce:

$ git clone https://github.com/jessesquires/JSQDataSourcesKit.git
$ cd JSQDataSourcesKit
$ git checkout -f 25ee7e2e2ab50d5e2237292ddc74973c68aee89a
$ open JSQDataSourcesKit.xcodeproj

Then in Xcode:

  1. Select the October 3 swift.org dev snapshot toolchain

  2. Select "JSQDataSourcesKit-iOS > Generic iOS Device" for the scheme

  3. Navigate to DataSourceProtocol.swift

  4. Replace its contents with the below:

    import Foundation
    
    public protocol DataSourceProtocol {
      associatedtype Item
    
      func numberOfSections() -> Int
      func numberOfItems
      extension DataSourceProtocol {
        public func item(atIndexPath indexPath: IndexPath) -> Item
  5. Build to get the crash below:

    Application Specific Information:
    Stack dump:
    0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-10-03-a.xctoolchain/usr/bin/swift -frontend -c -primary-file ... 
    1.  While type-checking 'DataSourceProtocol' at /Users/nathanhawes/workspace/open-swift-source-compat-suite-master/project_cache/JSQDataSourcesKit/Source/DataSourceProtocol.swift:4:8
    2.  While type-checking extension of DataSourceProtocol at /Users/nathanhawes/workspace/open-swift-source-compat-suite-master/project_cache/JSQDataSourcesKit/Source/DataSourceProtocol.swift:9:3
    3.  While type-checking 'item(atIndexPath:)' at /Users/nathanhawes/workspace/open-swift-source-compat-suite-master/project_cache/JSQDataSourcesKit/Source/DataSourceProtocol.swift:10:12
    4.  While validating 'item(atIndexPath:)' at /Users/nathanhawes/workspace/open-swift-source-compat-suite-master/project_cache/JSQDataSourcesKit/Source/DataSourceProtocol.swift:10:12
    5.  While resolving type Item at [/Users/nathanhawes/workspace/open-swift-source-compat-suite-master/project_cache/JSQDataSourcesKit/Source/DataSourceProtocol.swift:10:59 - line:10:59] RangeText=""
     
    Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/include/llvm/Support/Casting.h, line 106.
     
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib          0x00007fff7443bb86 __pthread_kill + 10
    1   libsystem_pthread.dylib         0x00007fff744f1c50 pthread_kill + 285
    2   libsystem_c.dylib               0x00007fff743a5268 __abort + 144
    3   libsystem_c.dylib               0x00007fff743a51d8 abort + 142
    4   libsystem_c.dylib               0x00007fff7436d868 __assert_rtn + 320
    5   swift                           0x00000001086ce71e swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::TypeResolution, swift::TypeResolutionOptions, bool) + 990
    6   swift                           0x00000001086d2922 resolveTypeDecl(swift::TypeDecl*, swift::SourceLoc, swift::DeclContext*, swift::TypeResolution, swift::GenericIdentTypeRepr*, swift::TypeResolutionOptions) + 210
    7   swift                           0x00000001086d0669 resolveIdentTypeComponent(swift::TypeResolution, llvm::ArrayRef<swift::ComponentIdentTypeRepr*>, swift::TypeResolutionOptions) + 1065
    8   swift                           0x00000001086cfe4b swift::TypeChecker::resolveIdentifierType(swift::TypeResolution, swift::IdentTypeRepr*, swift::TypeResolutionOptions) + 155
    9   swift                           0x00000001086d125a (anonymous namespace)::TypeResolver::resolveType(swift::TypeRepr*, swift::TypeResolutionOptions) + 282
    10  swift                           0x00000001086cf4a1 swift::TypeResolution::resolveType(swift::TypeRepr*, swift::TypeResolutionOptions) + 225
    11  swift                           0x00000001086d10b2 swift::TypeChecker::validateType(swift::TypeLoc&, swift::TypeResolution, swift::TypeResolutionOptions) + 98
    12  swift                           0x0000000108673565 checkGenericFuncSignature(swift::TypeChecker&, swift::GenericSignatureBuilder*, swift::AbstractFunctionDecl*, swift::TypeResolution) + 325
    13  swift                           0x0000000108673349 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 1545
    14  swift                           0x00000001086474e3 swift::TypeChecker::validateDecl(swift::ValueDecl*) + 5923
    15  swift                           0x0000000108650f70 (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) + 48
    16  swift                           0x0000000108642a18 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 184
    17  swift                           0x00000001086512bb (anonymous namespace)::DeclChecker::visitExtensionDecl(swift::ExtensionDecl*) + 443
    18  swift                           0x0000000108642a44 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 228
    19  swift                           0x0000000108650a0b (anonymous namespace)::DeclChecker::visitProtocolDecl(swift::ProtocolDecl*) + 587
    20  swift                           0x0000000108642f9d (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 1597
    21  swift                           0x0000000108642956 swift::TypeChecker::typeCheckDecl(swift::Decl*) + 38
    22  swift                           0x00000001086dc218 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1944
    23  swift                           0x000000010837da35 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 629
    24  swift                           0x000000010837d038 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 616
    25  swift                           0x00000001076b7067 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1335
    26  swift                           0x00000001076b5a9d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3021
    27  swift                           0x0000000107667f0e main + 686
    28  libdyld.dylib                   0x00007fff742fd085 start + 1
@nathawes
Copy link
Collaborator Author

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

2 participants