swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.55k stars 10.35k forks source link

Assertion failed: parenTy && "Associated value type is neither paren nor tuple?", file S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckPattern.cpp, line 1618 #65970

Open compnerd opened 1 year ago

compnerd commented 1 year ago

Description Assertion failure when launching LSP on SPM.

Steps to reproduce Launching LSP over SPM seems to trigger a sema assertion failure. HEAD at f353a618a4ddf50e4973eb301966108a5c698960. Package.resolved:

{
  "pins" : [
    {
      "identity" : "swift-argument-parser",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-argument-parser.git",
      "state" : {
        "revision" : "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
        "version" : "1.2.2"
      }
    },
    {
      "identity" : "swift-asn1",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-asn1.git",
      "state" : {
        "revision" : "805deae27a7506dcad043604c00a9dc52d465dcb",
        "version" : "0.7.0"
      }
    },
    {
      "identity" : "swift-certificates",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-certificates.git",
      "state" : {
        "revision" : "35a7df2d9d71c401a47de9be2e3de629a01370c2",
        "version" : "0.4.1"
      }
    },
    {
      "identity" : "swift-collections",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-collections.git",
      "state" : {
        "revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
        "version" : "1.0.4"
      }
    },
    {
      "identity" : "swift-crypto",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-crypto.git",
      "state" : {
        "revision" : "33a20e650c33f6d72d822d558333f2085effa3dc",
        "version" : "2.5.0"
      }
    },
    {
      "identity" : "swift-driver",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-driver.git",
      "state" : {
        "branch" : "main",
        "revision" : "0dfb2b7dd08604ae15e64489052b110599d42d3f"
      }
    },
    {
      "identity" : "swift-llbuild",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-llbuild.git",
      "state" : {
        "branch" : "main",
        "revision" : "af5683429477cd71fefc4f8942b59207ef08b311"
      }
    },
    {
      "identity" : "swift-system",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-system.git",
      "state" : {
        "revision" : "836bc4557b74fe6d2660218d56e3ce96aff76574",
        "version" : "1.1.1"
      }
    },
    {
      "identity" : "swift-tools-support-core",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-tools-support-core.git",
      "state" : {
        "branch" : "main",
        "revision" : "b3d8257d8b59da6d5dfc2d65e9587daecf47130a"
      }
    },
    {
      "identity" : "yams",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/jpsim/Yams.git",
      "state" : {
        "revision" : "f47ba4838c30dbd59998a4e4c87ab620ff959e8a",
        "version" : "5.0.5"
      }
    }
  ],
  "version" : 2
}

Open Sources:

Expected behavior Assertion failure should not occur.

Environment Swift version 5.9-dev (LLVM 1e0dbd7f055b049, Swift 2278172b43aa727) Target: x86_64-unknown-windows-msvc

compnerd commented 1 year ago
  30  Id: 57e8.10b04 Suspend: 0 Teb: 0000006f`97361000 Unfrozen
 # Child-SP          RetAddr               Call Site
00 0000006f`998fc980 00007ffd`1a220fae     ucrtbase!abort+0x4e
01 0000006f`998fc9b0 00007ffd`1a2211f1     ucrtbase!common_assert_to_stderr<wchar_t>+0x6e
02 0000006f`998fc9f0 00007ffc`73fed04d     ucrtbase!wassert+0x71
03 0000006f`998fca20 00007ffc`73fd7d23     sourcekitdInProc!swift::TypeChecker::coercePatternToType+0x270d [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckPattern.cpp @ 1621] 
04 (Inline Function) --------`--------     sourcekitdInProc!`anonymous-namespace'::StmtChecker::checkCaseLabelItemPattern+0xc3 [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 1487] 
05 0000006f`998fced0 00007ffc`73fe65bf     sourcekitdInProc!`anonymous namespace'::StmtChecker::checkSiblingCaseStmts<swift::OptionalTransformIterator<swift::ASTNode const *,swift::SwitchStmt::AsCaseStmtWithSkippingNonCaseStmts> >+0x1f3 [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 1587] 
06 0000006f`998fd020 00007ffc`73fdb433     sourcekitdInProc!`anonymous namespace'::StmtChecker::visitSwitchStmt+0x1ff [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 1651] 
07 0000006f`998fd110 00007ffc`73fe42d6     sourcekitdInProc!`anonymous namespace'::StmtChecker::typeCheckStmt<swift::Stmt>+0xa3 [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 1034] 
08 0000006f`998fd1e0 00007ffc`73fe565d     sourcekitdInProc!`anonymous namespace'::StmtChecker::typeCheckASTNode+0x56 [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 2052] 
09 0000006f`998fd290 00007ffc`73fdb303     sourcekitdInProc!`anonymous namespace'::StmtChecker::visitBraceStmt+0x1ad [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 2092] 
0a 0000006f`998fd2f0 00007ffc`73fe0ba8     sourcekitdInProc!`anonymous namespace'::StmtChecker::typeCheckStmt<swift::BraceStmt>+0xa3 [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 1034] 
0b (Inline Function) --------`--------     sourcekitdInProc!`anonymous-namespace'::StmtChecker::typeCheckBody+0x1e [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 1044] 
0c 0000006f`998fd3c0 00007ffc`744c31ea     sourcekitdInProc!swift::TypeCheckFunctionBodyRequest::evaluate+0x5c8 [S:\SourceCache\swift-project\swift\lib\Sema\TypeCheckStmt.cpp @ 2716] 
0d 0000006f`998fd520 00007ffc`744aecf7     sourcekitdInProc!swift::Evaluator::getResultUncached<swift::TypeCheckFunctionBodyRequest>+0x27a [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 388] 
0e 0000006f`998fd650 00007ffc`7449cd63     sourcekitdInProc!swift::Evaluator::getResultCached<swift::TypeCheckFunctionBodyRequest,0>+0x1b7 [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 418] 
0f (Inline Function) --------`--------     sourcekitdInProc!swift::Evaluator::operator()+0xc [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 276] 
10 0000006f`998fd6f0 00007ffc`7450cfa8     sourcekitdInProc!swift::evaluateOrDefault<swift::TypeCheckFunctionBodyRequest>+0x23 [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 106] 
11 0000006f`998fd750 00007ffc`73df9151     sourcekitdInProc!swift::AbstractFunctionDecl::getTypecheckedBody+0x28 [S:\SourceCache\swift-project\swift\lib\AST\Decl.cpp @ 8573] 
12 (Inline Function) --------`--------     sourcekitdInProc!typeCheckDelayedFunctions+0x98 [S:\SourceCache\swift-project\swift\lib\Sema\TypeChecker.cpp @ 250] 
13 0000006f`998fd780 00007ffc`73dd6e1a     sourcekitdInProc!swift::TypeCheckSourceFileRequest::evaluate+0x211 [S:\SourceCache\swift-project\swift\lib\Sema\TypeChecker.cpp @ 300] 
14 (Inline Function) --------`--------     sourcekitdInProc!swift::SimpleRequest<swift::TypeCheckSourceFileRequest,std::tuple<> __cdecl(swift::SourceFile *),12>::callDerived+0x14 [S:\SourceCache\swift-project\swift\include\swift\AST\SimpleRequest.h @ 267] 
15 0000006f`998fd860 00007ffc`73df2fb8     sourcekitdInProc!swift::SimpleRequest<swift::TypeCheckSourceFileRequest,std::tuple<> __cdecl(swift::SourceFile *),12>::evaluateRequest+0x1a [S:\SourceCache\swift-project\swift\include\swift\AST\SimpleRequest.h @ 290] 
16 0000006f`998fd890 00007ffc`73df150c     sourcekitdInProc!swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>+0x278 [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 388] 
17 0000006f`998fd9c0 00007ffc`73def4b6     sourcekitdInProc!swift::Evaluator::getResultCached<swift::TypeCheckSourceFileRequest,0>+0x19c [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 418] 
18 (Inline Function) --------`--------     sourcekitdInProc!swift::Evaluator::operator()+0xe [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 276] 
19 0000006f`998fda60 00007ffc`73dfcf1a     sourcekitdInProc!swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>+0x26 [S:\SourceCache\swift-project\swift\include\swift\AST\Evaluator.h @ 106] 
1a 0000006f`998fdad0 00007ffc`7302c43c     sourcekitdInProc!swift::performTypeChecking+0x2a [S:\SourceCache\swift-project\swift\lib\Sema\TypeChecker.cpp @ 260] 
1b (Inline Function) --------`--------     sourcekitdInProc!swift::CompilerInstance::performSema::__l2::<lambda_1>::operator()+0x8 [S:\SourceCache\swift-project\swift\lib\Frontend\Frontend.cpp @ 1381] 
1c 0000006f`998fdb00 00007ffc`73032a4e     sourcekitdInProc!llvm::function_ref<bool __cdecl(swift::SourceFile &)>::callback_fn<`swift::CompilerInstance::performSema'::`2'::<lambda_1> >+0xc [S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\STLFunctionalExtras.h @ 45] 
1d (Inline Function) --------`--------     sourcekitdInProc!llvm::function_ref<bool __cdecl(swift::SourceFile &)>::operator()+0xf [S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\STLFunctionalExtras.h @ 68] 
1e 0000006f`998fdb30 00007ffc`73038115     sourcekitdInProc!swift::CompilerInstance::forEachFileToTypeCheck+0x11e [S:\SourceCache\swift-project\swift\lib\Frontend\Frontend.cpp @ 1460] 
1f 0000006f`998fdb70 00007ffc`712eab01     sourcekitdInProc!swift::CompilerInstance::performSema+0x95 [S:\SourceCache\swift-project\swift\lib\Frontend\Frontend.cpp @ 1385] 
20 (Inline Function) --------`--------     sourcekitdInProc!`anonymous namespace'::ASTBuildOperation::buildASTUnit+0xa14 [S:\SourceCache\swift-project\swift\tools\SourceKit\lib\SwiftLang\SwiftASTManager.cpp @ 1095] 
21 (Inline Function) --------`--------     sourcekitdInProc!`anonymous namespace'::ASTBuildOperation::schedule::<lambda_5>::operator()+0xb15 [S:\SourceCache\swift-project\swift\tools\SourceKit\lib\SwiftLang\SwiftASTManager.cpp @ 1182] 
22 0000006f`998fdc10 00007ffc`7129cf4e     sourcekitdInProc!SourceKit::WorkQueue::DispatchData::callAndDelete<`lambda at S:\SourceCache\swift-project\swift\tools\SourceKit\lib\SwiftLang\SwiftASTManager.cpp:1156:7'>+0xb41 [S:\SourceCache\swift-project\swift\tools\SourceKit\include\SourceKit\Support\Concurrency.h @ 214] 
23 0000006f`998ffb60 00007ffc`7129cf7e     sourcekitdInProc!executeBlock+0xe [S:\SourceCache\swift-project\swift\tools\SourceKit\lib\Support\Concurrency-libdispatch.cpp @ 102] 
24 (Inline Function) --------`--------     sourcekitdInProc!llvm::thread::Apply+0x6 [S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\Support\thread.h @ 42] 
25 (Inline Function) --------`--------     sourcekitdInProc!llvm::thread::GenericThreadProxy+0x6 [S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\Support\thread.h @ 50] 
26 0000006f`998ffb90 00007ffd`1a1c9363     sourcekitdInProc!llvm::thread::ThreadProxy<std::tuple<void (*)(void *),void *> >+0xe [S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\Support\thread.h @ 70] 
27 0000006f`998ffbc0 00007ffd`1b7c26ad     ucrtbase!thread_start<unsigned int (__cdecl*)(void *),1>+0x93
28 0000006f`998ffbf0 00007ffd`1c86a9f8     kernel32!BaseThreadInitThunk+0x1d
29 0000006f`998ffc20 00000000`00000000     ntdll!RtlUserThreadStart+0x28
AnthonyLatsis commented 1 year ago

Open Sources:

Where are these from?

compnerd commented 1 year ago

@AnthonyLatsis apple/swift-package-manager@f353a618a4ddf50e4973eb301966108a5c698960