Skip to content

[SR-11535] Generic ambiguous none case is not diagnosed #53936

@theblixguy

Description

@theblixguy
Previous ID SR-11535
Radar rdar://problem/56056152
Original Reporter @theblixguy
Type Bug
Status Resolved
Resolution Done
Environment

Swift 5.1

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug, TypeChecker
Assignee maveric (JIRA)
Priority Medium

md5: 3440d3e720ac46459806c3e2a366f6c2

Issue Description:

The following code should trigger the ambiguous none warning, but doesn't:

enum Foo<T> {
  case bar
  static var none: Foo<Int> { .bar }
}

Expected:

let optionalFoo: Foo? = .none // warning: assuming you mean 'Optional<Foo>.none'; did you mean 'Foo<Int>.none' instead?

Actual

let optionalFoo: Foo? = .none // assigned Foo<Int>.none, instead of Optional.none

I am not sure why the solver is rejecting the Optional.none solution and going for Foo<Int>.none solution instead (maybe it's failing to bind T to a type?)

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 Implementationgood first issueGood for newcomerstype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions