Skip to content

[SR-168] Compiler incorrectly resolves type inference error as "ambiguous reference to member ..." #42790

@swift-ci

Description

@swift-ci
Previous ID SR-168
Radar None
Original Reporter nikita (JIRA User)
Type Bug
Environment

Xcode 7.2 (7C68)

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

md5: eb1b8c6f0b081ea09744c1503d1588d0

Issue Description:

In case function that takes closure require type inference resolution and it is called in a context where type can not be inferred compiler reports a wrong error. For example:

func a<T>(b: ()->()) -> T.Type {
    return T.self
}

let c = a {
    print("")
}

This code reports following error:

error: ambiguous reference to member 'print'

commenting out print cause a proper error:

error: generic parameter 'T' could not be inferred

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselftype checkerArea → compiler: Semantic analysis

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions