Skip to content

[SR-11511] A returning value of Array<Void> should give a warning, like Optional<Void> #53912

Closed
@BasThomas

Description

@BasThomas
Previous ID SR-11511
Radar None
Original Reporter @BasThomas
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, StarterBug
Assignee jder (JIRA)
Priority Medium

md5: ebcfa84ec27da83a255c80a10ed317da

Issue Description:

let optOne: Int? = 1
let y = optOne.map { _ in return () } // Constant 'y' inferred to have type '()?', which may be unexpected
let z = [""].map { _ in return () } // no warning.

// The expected warning would be:
// Constant 'z' inferred to have type '[()]', which may be unexpected

For more information see the thread in this tweet.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions