Skip to content
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

Code completion error when function name is Type() #6909

Closed
lbnnbs opened this issue Jan 3, 2024 · 3 comments · Fixed by #6915
Closed

Code completion error when function name is Type() #6909

lbnnbs opened this issue Jan 3, 2024 · 3 comments · Fixed by #6915
Assignees
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Milestone

Comments

@lbnnbs
Copy link

lbnnbs commented Jan 3, 2024

Apache NetBeans version

Apache NetBeans 20

What happened

1
2

code completion is always return self.

Language / Project Type / NetBeans Component

PHP project

How to reproduce

name a function as Type()

Did this work correctly in an earlier version?

No, All versions have this error.

Operating System

Windows 10

JDK

JDK21

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

@lbnnbs lbnnbs added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Jan 3, 2024
@junichi11 junichi11 added the PHP [ci] enable extra PHP tests (php/php.editor) label Jan 3, 2024
@junichi11
Copy link
Member

junichi11 commented Jan 3, 2024

Please write an whole example code to reproduce it with details(Expected result and actual result, etc.). (not only images)

@lbnnbs
Copy link
Author

lbnnbs commented Jan 4, 2024

`<?php

class Test {

/**
 * 
 * @return int
 */
public function Type() {
    return 0;
}

public function aaa() {
    // code completion make mistake here
    $this->Type()->
}

}
`

微信截图_20240104100442

@junichi11
Copy link
Member

Reproducible. Thanks!

@junichi11 junichi11 removed the needs:triage Requires attention from one of the committers label Jan 4, 2024
@junichi11 junichi11 self-assigned this Jan 4, 2024
@junichi11 junichi11 added this to the NB21 milestone Jan 4, 2024
junichi11 added a commit to junichi11/netbeans that referenced this issue Jan 4, 2024
… prefixes apache#6909

- apache#6909
- To avoid conflicting with member names, add `-type` suffix to semi-type prefixes because "-" can not be contained to member names
- Add unit tests

Example:
```php
class Example {
    public function Type(): int {
        return 0;
    }

    public function test(): void {
        $this->Type()-> // before: Example members(`Type()`, `test()`) are shown
                        // after : no items
    }
}
```
junichi11 added a commit that referenced this issue Jan 4, 2024
…-type-method

Fix incorrect code completion with the same member names as semi-type prefixes #6909
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
2 participants