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-12460] Declaring an operator inside an extension without a name crashes the compiler #54900

Closed
ahoppen opened this issue Mar 31, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Mar 31, 2020

Previous ID SR-12460
Radar None
Original Reporter @ahoppen
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, StarterBug
Assignee eyork (JIRA)
Priority Medium

md5: 26eab3f6c5941d48cff67d6d858e32f8

Issue Description:

Trying to compile the following code crashes the compiler:

extension {
  func ==(lhs: Foo, rhs: Foo) -> Bool {}
} 

Note that the extension hasn’t got a name.

Stack trace:

1.  Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
2.  While evaluating request IsStaticRequest(test.(file). extension.==@/Users/alex/Desktop/test/test/main.swift:2:8)
0  swift                    0x000000010482a4ea PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x0000000104829cc0 SignalHandler(int) + 352
2  libsystem_platform.dylib 0x00007fff6bdc042d _sigtramp + 29
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2485386224
4  swift                    0x00000001015d9671 swift::DiagnosticEngine::formatDiagnosticText(llvm::raw_ostream&, llvm::StringRef, llvm::ArrayRef<swift::DiagnosticArgument>, swift::DiagnosticFormatOptions) + 5633
5  swift                    0x0000000100899d7b swift::PrintingDiagnosticConsumer::printDiagnostic(swift::SourceManager&, swift::DiagnosticInfo const&) + 1291
6  swift                    0x00000001008995fd swift::PrintingDiagnosticConsumer::handleDiagnostic(swift::SourceManager&, swift::DiagnosticInfo const&) + 45
7  swift                    0x00000001015d65e1 swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 1713
8  swift                    0x00000001015d5c9c swift::DiagnosticEngine::flushActiveDiagnostic() + 604
9  swift                    0x000000010122349d swift::SimpleRequest<swift::IsStaticRequest, bool (swift::FuncDecl*), (swift::CacheKind)2>::evaluateRequest(swift::IsStaticRequest const&, swift::Evaluator&) + 1805
10 swift                    0x000000010157f99e swift::IsStaticRequest::OutputType swift::evaluateOrDefault<swift::IsStaticRequest>(swift::Evaluator&, swift::IsStaticRequest, swift::IsStaticRequest::OutputType) + 958
11 swift                    0x00000001015991d2 swift::ValueDecl::isInstanceMember() const + 178
12 swift                    0x000000010091570a swift::index::getSymbolInfoForDecl(swift::Decl const*) + 218
13 swift                    0x000000010090a5dc (anonymous namespace)::IndexSwiftASTWalker::initIndexSymbol(swift::ValueDecl*, swift::SourceLoc, bool, swift::index::IndexSymbol&) + 252
14 swift                    0x0000000100907357 (anonymous namespace)::IndexSwiftASTWalker::walkToDeclPre(swift::Decl*, swift::CharSourceRange) + 1911
15 swift                    0x00000001008ff704 (anonymous namespace)::SemaAnnotator::walkToDeclPre(swift::Decl*) + 1876
16 swift                    0x0000000101556dd6 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 230
17 swift                    0x000000010155956e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Decl*) + 2654
18 swift                    0x0000000101556e03 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 275
19 swift                    0x00000001016491b2 swift::SourceFile::walk(swift::ASTWalker&) + 146
20 swift                    0x00000001008fdd0b swift::SourceEntityWalker::walk(swift::SourceFile&) + 235
21 swift                    0x000000010090d5cf (anonymous namespace)::IndexSwiftASTWalker::visitModule(swift::ModuleDecl&) + 223
22 swift                    0x000000010090ed96 recordSourceFileUnit(swift::SourceFile*, llvm::StringRef, llvm::StringRef, bool, bool, llvm::StringRef, llvm::ArrayRef<clang::FileEntry const*>, clang::CompilerInstance const&, swift::DiagnosticEngine&) + 2870
23 swift                    0x0000000100581e5b emitIndexDataIfNeeded(swift::SourceFile*, swift::CompilerInvocation const&, swift::CompilerInstance&) + 779
24 swift                    0x000000010057a02a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 38282
25 swift                    0x00000001004f44d3 main + 1283
26 libdyld.dylib            0x00007fff6bbc77fd start + 1
error: Segmentation fault: 11 (in target 'test' from project 'test') 

Using Swift 5.2 shipped with Xcode 11.4 (11E146, swiftlang-1103.0.32.1)

@swift-ci
Copy link
Collaborator

Comment by Eric York (JIRA)

I am trying a fix this issue: #30979

@swift-ci
Copy link
Collaborator

Comment by Eric York (JIRA)

Fixed in #30979

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants