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-8812] Assertion failure in ValueDecl::isAccessibleFrom() #51320

Closed
nathawes opened this issue Sep 21, 2018 · 2 comments
Closed

[SR-8812] Assertion failure in ValueDecl::isAccessibleFrom() #51320

nathawes opened this issue Sep 21, 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-8812
Radar rdar://problem/44664036
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 16b480f72794af46c2614c64f175d575

Issue Description:

{code: title=$ cat /tmp/test.swift}
public protocol LocalizedError : Error {
var errorDescription: String? { get }
}

public enum AFError: Error {}
extension AFError {
public var isInvalidURLError: Bool {

extension AFError: LocalizedError {
public var errorDescription: String? {
return ""

{code: title=$ swift /tmp/test.swift}
/tmp/test.swift:12:1: error: expected '}' at end of brace statement

^
/tmp/test.swift:10:42: note: to match this opening '{'
    public var errorDescription: String? {
                                         ^
/tmp/test.swift:12:1: error: expected '}' at end of extension

^
/tmp/test.swift:9:35: note: to match this opening '{'
extension AFError: LocalizedError {
                                  ^
/tmp/test.swift:9:1: error: declaration is only valid at file scope
extension AFError: LocalizedError {
^
/tmp/test.swift:12:1: error: expected '}' at end of brace statement

^
/tmp/test.swift:7:40: note: to match this opening '{'
    public var isInvalidURLError: Bool {
                                       ^
/tmp/test.swift:12:1: error: expected '}' at end of extension

^
/tmp/test.swift:6:19: note: to match this opening '{'
extension AFError {
                  ^
Assertion failed: (getDeclContext()->getSelfProtocolDecl() || isOperator() || result == checkAccessUsingAccessScopes(useDC, this, access)), function isAccessibleFrom, file /Users/nhawes/github/swift/lib/AST/Decl.cpp, line 2646.
Stack dump:
0.  Program arguments: /Users/nhawes/github/build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file /tmp/test.swift -target x86_64-apple-darwin18.0.0 -enable-objc-interop -color-diagnostics -module-name test -o /var/folders/wq/tdzgm3g56_98b0h3fv0mn61w0000gn/T/test-0d9f41.o 
0  swift                    0x0000000103f21138 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x0000000103f203b5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x0000000103f21742 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff5a953b3d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000003e58 _sigtramp + 2775253816
5  libsystem_c.dylib        0x00007fff5a8121c9 abort + 127
6  libsystem_c.dylib        0x00007fff5a7da868 basename_r + 0
7  swift                    0x00000001016639e9 swift::ValueDecl::isAccessibleFrom(swift::DeclContext const*, bool) const + 249
8  swift                    0x0000000101397a2e swift::WitnessChecker::checkWitnessAccess(swift::AccessScope&, swift::ValueDecl*, swift::ValueDecl*, bool*) + 222
9  swift                    0x0000000101397c5a swift::WitnessChecker::checkWitness(swift::AccessScope, swift::ValueDecl*, swift::RequirementMatch const&) + 122
10 swift                    0x000000010139e72c swift::ConformanceChecker::resolveWitnessViaLookup(swift::ValueDecl*) + 1196
11 swift                    0x000000010139af79 swift::ConformanceChecker::checkConformance(swift::MissingWitnessDiagnosisKind) + 729
12 swift                    0x0000000101399abc swift::MultiConformanceChecker::checkIndividualConformance(swift::NormalProtocolConformance*, bool) + 6156
13 swift                    0x00000001013980e2 swift::MultiConformanceChecker::checkAllConformances() + 114
14 swift                    0x00000001013a2b87 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 3063
15 swift                    0x00000001013ed9fe typeCheckFunctionsAndExternalDecls(swift::SourceFile&, swift::TypeChecker&) + 174
16 swift                    0x00000001013eec4b swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 2139
17 swift                    0x0000000101090698 swift::CompilerInstance::parseAndTypeCheckMainFileUpTo(swift::SourceFile::ASTStage_t, swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>) + 472
18 swift                    0x000000010108f2d7 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 439
19 swift                    0x000000010108e993 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 627
20 swift                    0x00000001003e39b6 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1334
21 swift                    0x00000001003e23ed swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3021
22 swift                    0x000000010039456e main + 686
23 libdyld.dylib            0x00007fff5a76a085 start + 1
<unknown>:0: error: unable to execute command: Abort trap: 6
@nathawes
Copy link
Collaborator Author

@swift-ci create

@slavapestov
Copy link
Member

Looks like this was already fixed along the way. I added a test case: #19682

@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