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-8984] Compiler crash: swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) #51488

Closed
nathawes opened this issue Oct 12, 2018 · 2 comments
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-8984
Radar rdar://problem/45242943
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: c1453cc2e683a25431169260d2de6712

is duplicated by:

  • SR-9002 Compiler crash: swift::FunctionType::get(llvm::ArrayRefswift::AnyFunctionType::Param, swift::Type, swift::AnyFunctionType::ExtInfo)
  • SR-9005 Compiler crash: swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) – different trace to SR-8984
  • SR-9007 Assertion failure in swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::TypeResolution, swift::TypeResolutionOptions, bool)

Issue Description:

In Terminal checkout Alamofire as follows:

$ git clone https://github.com/Alamofire/Alamofire.git
$ cd Alamofire
$ git checkout -f b03b43cc381ec02eb9855085427186ef89055eef
$ open Alamofire.xcworkspace

Then in Xcode:

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

  2. Select 'Alamofire macOS > My Mac' scheme and destination

  3. Navigate to Response.swift

  4. Paste in the content of the attached 'Response-crasher.swift' file

  5. Build to get the below crash.

Application Specific Information:
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-10-03-a.xctoolchain/usr/bin/swift -frontend -typecheck ...
1.  While type-checking getter for metrics at /Users/nhawes/Desktop/xfails/Alamofire/Source/Response.swift:193:16
2.  While type-checking statement at [/Users/nhawes/Desktop/xfails/Alamofire/Source/Response.swift:193:48 - line:211:50] RangeText="{ return _metrics
 
@available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
extension DataResponse: Response {
#if !os(watchOS)
    /// The task metrics containing the request / response statistics.
    public var metrics: URLSessionTaskMetrics? { return
 
@available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
extension DefaultDownloadResponse: Response {
#if !os(watchOS)
    /// The task metrics containing the request / response statistics.
    public var metrics: URLSessionTaskMetrics? { return
 
@available(iOS 10.0, macOS 10.12, tvOS 10.0, *)
extension DownloadResponse: Response {
#if !os(watchOS)
    /// The task metrics containing the request / response statistics.
    public var metrics: URLSessionTaskMetrics? { "
3.  While type-checking statement at [/Users/nhawes/Desktop/xfails/Alamofire/Source/Response.swift:193:50 - line:193:57] RangeText="return "
4.  While type-checking expression at [/Users/nhawes/Desktop/xfails/Alamofire/Source/Response.swift:193:57 - line:193:57] RangeText=""
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   swift                           0x000000010d0a69ac swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) + 12
1   swift                           0x000000010d0e4fb5 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1189
2   swift                           0x000000010cd90856 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::TypoCorrectionResults&, swift::GenericSignatureBuilder*, unsigned int) + 278
3   swift                           0x000000010cd45f07 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 7975
4   swift                           0x000000010cd50cba (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) + 442
5   swift                           0x000000010d0403ee swift::Expr::walk(swift::ASTWalker&) + 30
6   swift                           0x000000010cd46bc7 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 327
7   swift                           0x000000010cdd6017 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 8087
8   swift                           0x000000010cdd6cc8 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::Stmt>(swift::Stmt*&) + 136
9   swift                           0x000000010cdd4177 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 247
10  swift                           0x000000010cdd3578 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 136
11  swift                           0x000000010cdd2114 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 260
12  swift                           0x000000010cdd2c4f swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 271
13  swift                           0x000000010cdf3116 typeCheckFunctionsAndExternalDecls(swift::SourceFile&, swift::TypeChecker&) + 310
14  swift                           0x000000010cdf428d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 2061
15  swift                           0x000000010ca95a35 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 629
16  swift                           0x000000010ca95038 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 616
17  swift                           0x000000010bdcf067 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1335
18  swift                           0x000000010bdcda9d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3021
19  swift                           0x000000010bd7ff0e main + 686
20  libdyld.dylib                   0x00007fff58fa3085 start + 1
@nathawes
Copy link
Collaborator Author

@swift-ci create

@slavapestov
Copy link
Member

#19905

@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

3 participants