Skip to content

[CodeCompletion] Improve context type analysis for overloaded method #20013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2018

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 24, 2018

For:

    class MyClass {
        func foo(x: SomeType)
        func foo(x: OtherType)
    }

    func test(obj: MyClass) {
        obj.foo(x: #^COMPLETE^#
    }

Type checker doesn't keep overloaded choices for obj.foo in the AST after typechecking. Code completion need to lookup members to collect possible parameter types.

@rintaro
Copy link
Member Author

rintaro commented Oct 24, 2018

@swift-ci Please smoke test

@rintaro rintaro force-pushed the ide-completion-overloadedmethod branch 2 times, most recently from 830707f to 9d8bad0 Compare October 26, 2018 06:41
@rintaro
Copy link
Member Author

rintaro commented Oct 27, 2018

@swift-ci Please smoke test

@benlangmuir
Copy link
Contributor

We should share the lookup code here with the subscript case from #20066 if we can. I suggest changing this PR to pull that into a function and then use that from #20066. Otherwise LGTM.

@rintaro rintaro force-pushed the ide-completion-overloadedmethod branch from 9d8bad0 to 5f8d298 Compare October 29, 2018 23:59
@rintaro
Copy link
Member Author

rintaro commented Oct 30, 2018

@swift-ci Please smoke test

For:

    class MyClass {
        func foo(x: SomeType)
        func foo(x: OtherType)
    }

    func test(obj: MyClass) {
        obj.foo(x: <HERE>)
    }

Type checker doesn't keep overloaded choices for 'obj.foo' in the AST
after typechecking. Code completion need to lookup members to collect
possible parameter types.
@rintaro rintaro force-pushed the ide-completion-overloadedmethod branch from 5f8d298 to c84ea2b Compare October 30, 2018 00:02
@rintaro
Copy link
Member Author

rintaro commented Oct 30, 2018

@swift-ci Please smoke test

@rintaro rintaro merged commit fe59d99 into swiftlang:master Oct 30, 2018
@rintaro rintaro deleted the ide-completion-overloadedmethod branch October 30, 2018 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants