swiftlang/swift

[SR-8797] Misleading compiler errors

Open

#51,305 opened on Sep 19, 2018

View on GitHub
 (7 comments) (0 reactions) (0 assignees)Swift (10,719 forks)batch import
bugcompilerdiagnostics qualitygood first issuetype checker

Repository metrics

Stars
 (69,989 stars)
PR merge metrics
 (Avg merge 8d 17h) (510 merged PRs in 30d)

Description

Previous ID SR-8797
Radar rdar://problem/44616337
Original Reporter @jeremyabannister
Type Bug
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug, TypeChecker
Assignee None
Priority Medium

md5: f2dc6c9ca2ac0b74c004d15fc50e5a7b

Issue Description:

typealias Executable <Input> = (Input)->()
let test: Executable<Void>? = { }

The code above leads to the error:

Cannot convert value of type '() -> ()' to specified type '((Void) -> ())?'

Whereas this code compiles successfully:

typealias Executable <Input> = (Input)->()
let test: Executable<Void>? = { _ in }

Contributor guide