EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.74k stars 293 forks source link

Class metatables cause all subsequent uses of property to be assigned to first 1 #428

Open 133794m3r opened 3 years ago

133794m3r commented 3 years ago

Environment(环境)

name version
IDEA version CLION 2021.1
EmmyLua version v1.3.6.215-IDEA
OS GNU/Linux

What are the steps to reproduce this issue?(重现步骤?)

  1. First use Hump or similar class library.
  2. Define 2 classes with the same method name(but are no imported as each other.
  3. EmmyLua helpfully will reference the first class that you created and show documentation for it.

What happens?(出现什么问题?)

The method says it belongs to the other class.

What were you expecting to happen?(期望?)

I would've expected it to realize that they're not the same overload. As it's a new class. It is acting as if this new Class metatable belongs to the other one when they're not in any way related.

Any logs, error output, etc?(有没有什么log, error输出?)

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?(其它说明)

It's just super weird seeing it. It is mapping all methods of this class to the other one but it didn't do that for the other file. It apparently looks for the first entry of a method/property and automatically assumes that that is the only one that it'll ever be in/at. All methods for classes/other properties of the metatable which doesn't make sense.

The values are all part of the metatable that holds the class and are properties of that class. Plus since they are properties of it, they are not global attributes. There is no reason properties/keys can't be shared. So I think that is where the issue is coming from.

SamB commented 2 years ago

Hmm, it's generally advised to provide test file(s) that demonstrate the issue; inline in the issue if practical, but if you need long files or many of them, possibly on https://gist.github.com/ or linking to a specific commit in a repository?