Skip to content

[SR-7046] Autocomplete suggests methods that can't be called on certain instances #49594

@AnthonyLatsis

Description

@AnthonyLatsis
Previous ID SR-7046
Radar rdar://problem/45340583
Original Reporter @AnthonyLatsis
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode Version 9.2 (9C40b)

Additional Detail from JIRA
Votes 3
Component/s CodeCompletion
Labels Bug
Assignee @rintaro
Priority Medium

md5: 2666fe154a7afbbb66b70fdd218be9a2

relates to:

  • SR-9027 SourceKit suggests autocomplete for unavailable constrained methods
  • SR-9396 Nonsensical error message related to constrained extensions

Issue Description:

On the screenshot, `foo` can't be called on b, and the compiler will rightly show an error if I hit enter on the Autocomplete suggestion below.

![](Screen Shot 2018-02-21 at 1.41.38 AM.png)

I am not sure if Autocomplete is currently meant to be this smart, but if by any chance it is, here you go.

Another example:

extension Array { 
   func foo(...) where Element == Int { ... }
 // This method will also always be visible in code completion, regardless of what type Element is
} 

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completionsource toolingArea: IDE support, SourceKit, and other source tooling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions