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-7364] SegFault with implicit associated type #49912

Closed
mdiep opened this issue Apr 5, 2018 · 3 comments
Closed

[SR-7364] SegFault with implicit associated type #49912

mdiep opened this issue Apr 5, 2018 · 3 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

@mdiep
Copy link
Contributor

mdiep commented Apr 5, 2018

Previous ID SR-7364
Radar rdar://problem/39239629
Original Reporter @mdiep
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 9.3.0
Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)
Target: x86_64-apple-darwin17.5.0

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

md5: a6ef775ea809b295629b03bcae1fc501

Issue Description:

This code segfaults:

public protocol E {
    associatedtype F
    
    static func g(_: F) -> Self
}

internal enum CF {
    case f
}

internal enum CE: E {
    case f(CF)
    
    static func g(_ f: CF) -> CE {
        return CE.f(f)
    }
    
    static let cf = CE.g(.f)
}

If you add typealias F = CF to CE, then it compiles.

@belkadan
Copy link
Contributor

belkadan commented Apr 6, 2018

Bizarre! @DougGregor, @huonw, any ideas? Doesn't seem to be a regression, at least.

@swift-ci create

@huonw
Copy link
Mannequin

huonw mannequin commented Apr 9, 2018

Reduced slightly:

protocol E {
    associatedtype F
    func g(_: F) -> Self
}
struct CF {}
struct CE: E {
   func g(_: CF) -> CE {}
}
_ = CE().g(CF())

I can't reduce that signature of g any more: the Self seems to need to be Self specifically and be returned.

The output with asserts on:

main.(file).CE@sr-7364.swift:6:8 is missing witness for E.g
0  swift                    0x000000010dac0b08 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010dac1216 SignalHandler(int) + 694
2  libsystem_platform.dylib 0x00007fff70db0f5a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2401562816
4  libsystem_c.dylib        0x00007fff70bdb312 abort + 127
5  swift                    0x000000010b48e6c5 (anonymous namespace)::Verifier::verifyConformance(swift::Decl*, swift::ProtocolConformance*) + 2133
6  swift                    0x000000010b48d67e (anonymous namespace)::Verifier::verifyChecked(swift::NominalTypeDecl*) + 158
7  swift                    0x000000010b485db2 (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) + 3762
...

@DougGregor
Copy link
Member

#16069

@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

4 participants