Skip to content

[SR-3470] Compiler displays wrong error message when calling a constructor to cause a type mismatch #46058

@swift-ci

Description

@swift-ci
Previous ID SR-3470
Radar None
Original Reporter Sweeper (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode 8.1

macOS Sierra 10.12

Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9

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

md5: 01e588e13a060ad512276df0a96a822f

Issue Description:

If you compile the code in the attachment, you will see two different compiler error messages on line 6 and 7.

On line 6,

Cannot convert value of type 'A' to specified type 'Void' (aka '()')

On line 7,

Cannot invoke initializer for type 'A' with an argument list of type '(x: Int, y: Double)'

But in theory, the real problem of the two lines are the same - assigning A to Void. I expected the messages to both be

Cannot convert value of type 'A' to specified type 'Void' (aka '()')

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 ImplementationexpressionsFeature: expressionsinitFeature → declarations: InitializersoverloadingFeature: Overloading symbol namesswift 3.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