Skip to content

[SR-10562] Imported NS_ERROR_ENUM errors have weird "related decl" description #52962

@lilyball

Description

@lilyball
mannequin
Previous ID SR-10562
Radar None
Original Reporter @lilyball
Type Bug
Environment

Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.5.0

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

md5: e29b89b358725c5ca7df0cc90a76c495

Issue Description:

When printing an error created from an Obj-C NS_ERROR_ENUM declaration, the imported error has a bizarre synthesized description that looks like "related decl 'e' for <desc>" (where <desc> is the actual expected description).

For example, with the following Obj-C header:

extern NSErrorDomain const FooErrorDomain;
typedef NS_ERROR_ENUM(FooErrorDomain, FooError) {
    FooErrorOne = 1,
    FooErrorTwo
};

Printing a FooError(.one) from Swift produces the description

related decl 'e' for FooError(_nsError: Error Domain=FooErrorDomain Code=1 "(null)")

And the debug description looks like

__C_Synthesized.related decl 'e' for FooError(_nsError: Error Domain=FooErrorDomain Code=1 "(null)")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfruntimeThe Swift Runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions