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

迭代器返回类型识别失败 #178

Closed
jinsediaoying opened this issue Aug 14, 2018 · 7 comments
Closed

迭代器返回类型识别失败 #178

jinsediaoying opened this issue Aug 14, 2018 · 7 comments

Comments

@jinsediaoying
Copy link

Environment(环境)

name version
IDEA version IC2018.2 EAP
EmmyLua version v1.2.5
OS win 7

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

t yesn i 3 n874 ebo7

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

无法识别迭代器返回的类型

@ice1000
Copy link
Member

ice1000 commented Aug 14, 2018

你写错了

@ice1000
Copy link
Member

ice1000 commented Aug 14, 2018

你的写法的含义是,test()返回一个函数,这个函数没有参数,返回number,A,因此如果你改成a(),再按一下.,就可以看到代码提示了。
改成@return number,A应该就没有问题。当然也不排除阿唐又写了bug,当然那就是另外一回事了,不属于这个issue讨论范畴。

@ice1000 ice1000 closed this as completed Aug 14, 2018
@tangzx
Copy link
Member

tangzx commented Aug 15, 2018

写法没问题,已解决

@ice1000
Copy link
Member

ice1000 commented Aug 15, 2018

@tangzx 蛤?这语义要是对的话那这岂不是很不清真?明明是return后面应该跟返回类型啊,怎么跟的是函数类型呢

@tangzx
Copy link
Member

tangzx commented Aug 15, 2018

没错,函数本身也是一种类型
可以看成
---@return (fun():number, A)

@tangzx
Copy link
Member

tangzx commented Aug 15, 2018

他那个是省略了,完整的应该是这样

---@return fun():number, A
function t.test()
    return function()
        return 1, A
    end
end

@ice1000
Copy link
Member

ice1000 commented Aug 15, 2018

黑历史++

tangzx added a commit that referenced this issue Aug 17, 2018
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

No branches or pull requests

3 participants