[BUG]Wrong line number In lua 5.4(work 2)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[BUG]Wrong line number In lua 5.4(work 2)

actboy168@gmail.com
local b = true

if not b then
    return
end

error 'test'


The line number in the error message is 5, but it should be 7.


Reply | Threaded
Open this post in threaded view
|

Re: [BUG]Wrong line number In lua 5.4(work 2)

Hugo Musso Gualandi
I can also reproduce this if I put the error call inside an else
statement. For the following program Lua5.3 says the error is in line 6
but 5.4 says it is in line 4.

--------------
local b = true

if not b then
    return
else
    error 'test'
end
-------------

Interestingly, it seems that other small changes make this bug
disappear, and that the original example is already very minimal. I
can't reproduce the bug if I use a global "b = true" instead of "local
b = true". The bug is also not present if I use "local b = false"
combined with "if b", or if I switch the condition to "if false" or "if
not true".

Reply | Threaded
Open this post in threaded view
|

Re: [BUG]Wrong line number In lua 5.4(work 2)

Roberto Ierusalimschy
In reply to this post by actboy168@gmail.com
> local b = true
>
> if not b then
>     return
> end
>
> error 'test'
>
>
> The line number in the error message is 5, but it should be 7.

How did you find this bug?

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: [BUG]Wrong line number In lua 5.4(work 2)

Dibyendu Majumdar
On 10 July 2018 at 18:34, Roberto Ierusalimschy <[hidden email]> wrote:

>> local b = true
>>
>> if not b then
>>     return
>> end
>>
>> error 'test'
>>
>>
>> The line number in the error message is 5, but it should be 7.
>
> How did you find this bug?
>

I suspect because of:

https://marketplace.visualstudio.com/items?itemName=actboy168.lua-debug

Reply | Threaded
Open this post in threaded view
|

Re: [BUG]Wrong line number In lua 5.4(work 2)

actboy168@gmail.com

Yes. It is easy to find an incorrect line in the debugger.

 

-- actboy168



Dibyendu Majumdar <[hidden email]> 于2018年7月11日周三 上午4:52写道:
On 10 July 2018 at 18:34, Roberto Ierusalimschy <[hidden email]> wrote:
>> local b = true
>>
>> if not b then
>>     return
>> end
>>
>> error 'test'
>>
>>
>> The line number in the error message is 5, but it should be 7.
>
> How did you find this bug?
>

I suspect because of:

https://marketplace.visualstudio.com/items?itemName=actboy168.lua-debug