Skip to content

[SR-13503] InsertExplicitCall fix not created for callable values #55945

@theblixguy

Description

@theblixguy
Previous ID SR-13503
Radar rdar://problem/68376691
Original Reporter @theblixguy
Type Bug
Environment

Swift version 5.3-dev (LLVM 19447e2, Swift e41a0976e0bdb09)
Target: x86_64-apple-darwin19.5.0

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

md5: cf7afdf3fd38fee6a0ef870bb5bd3d36

Issue Description:

struct S {
  func callAsFunction() -> Int { 0 }
}

let s = S()

func doIt(arg: Int) { print(arg) }
doIt(arg: s) // error: cannot convert value of type 'S' to expected argument type 'Int'

In the above scenario, it is possible to call s (by adding ()) to produce the expected value of type Int. So, we should create the InsertExplicitCall fix (or create a fix tailored for callable values) in order to emit a better diagnostic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions