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-11812] Cannot use key path subscript with a variadic parameter #54223

Closed
hamishknight opened this issue Nov 19, 2019 · 0 comments
Closed
Assignees
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 key paths Feature: key paths (both native and Objective-C)

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-11812
Radar None
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.1.1-dev (Swift c0c247e)
Target: x86_64-apple-darwin19.0.0

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

md5: e5849ddea8ab2286eb2d2220a31eaa47

Issue Description:

The following currently crashes the compiler:

struct S {
  subscript(x: Int...) -> Int { 0 }
}

let k = \S.[1, 2, 3]

Stack dump:

Assertion failed: (hashable.isAbstract() || hashable.getConcrete()->getType()->isEqual(formalTy)), function lowerKeyPathSubscriptIndexPatterns, file /Users/hamishknight/Desktop/swift-dev/swift/lib/SILGen/SILGenExpr.cpp, line 3356.
Stack dump:
0.  Program arguments: ./swift -frontend -emit-silgen /Users/hamishknight/Desktop/newnew/newnew/main.swift -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -debug-diagnostic-names
1.  Swift version 5.1.1-dev (Swift c0c247e7b5)
0  swift                    0x0000000107311e55 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x0000000107310e58 llvm::sys::RunSignalHandlers() + 248
2  swift                    0x0000000107312448 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff6b473b1d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000004de0 _sigtramp + 2495156960
5  libsystem_c.dylib        0x00007fff6b349a08 abort + 120
6  libsystem_c.dylib        0x00007fff6b348cc2 err + 0
7  swift                    0x0000000107417113 swift::Lowering::SILGenModule::emitKeyPathComponentForDecl(swift::SILLocation, swift::GenericEnvironment*, swift::ResilienceExpansion, unsigned int&, bool&, swift::SubstitutionMap, swift::AbstractStorageDecl*, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::CanType, bool) (.cold.17) + 35
8  swift                    0x00000001036e587d swift::Lowering::SILGenModule::emitKeyPathComponentForDecl(swift::SILLocation, swift::GenericEnvironment*, swift::ResilienceExpansion, unsigned int&, bool&, swift::SubstitutionMap, swift::AbstractStorageDecl*, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::CanType, bool) + 5309
9  swift                    0x00000001036fa5f1 (anonymous namespace)::RValueEmitter::visitKeyPathExpr(swift::KeyPathExpr*, swift::Lowering::SGFContext) + 1569
10 swift                    0x00000001036ee03a swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 154
11 swift                    0x00000001036e0eff swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 303
12 swift                    0x00000001036d2dbf swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 335
13 swift                    0x00000001036d2e9d swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 45
14 swift                    0x0000000103687112 swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 498
15 swift                    0x0000000103687633 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 915
16 swift                    0x0000000103688589 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&, swift::FileUnit*) + 313
17 swift                    0x0000000103688941 swift::performSILGeneration(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&) + 17
18 swift                    0x0000000103389d3b performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8155
19 swift                    0x0000000103386de6 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3046
20 swift                    0x000000010332c259 main + 729
21 libdyld.dylib            0x00007fff6b272405 start + 1
22 libdyld.dylib            0x0000000000000007 start + 2497240067
fish: './swift -frontend -emit-silgen…' terminated by signal SIGABRT (Abort)
@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 key paths Feature: key paths (both native and Objective-C)
Projects
None yet
Development

No branches or pull requests

2 participants