Skip to content

[SR-14291] Compiler doesn't tell where the error occurs. #56650

@YOCKOW

Description

@YOCKOW
Previous ID SR-14291
Radar rdar://problem/74876041
Original Reporter @YOCKOW
Type Bug
Environment

Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.3.0

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

md5: 9a5fd6b71ce55da5783b9975045cb234

Issue Description:

Try to compile the following code:

class C {
  init() throws {}
}

class D: C {
  let i: Int
  init(i: Int) {
    self.i = i
  }
}

The compiler views error like
<unknown>:0: error: call can throw, but it is not marked with 'try' and the error is not handled.

D seems to call super.init implicitly, but the error message doesn't imply it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdeclarationsFeature: declarationsdiagnostics QoIBug: Diagnostics Quality of Implementationerror handlinginheritanceFeature → type declarations → class: Subclassing and inheritance of class membersinitFeature → declarations: Initializersswift 6.0type checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions