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

unexpected propagation of <const> attribute #759

Closed
fperrad opened this issue Jul 7, 2024 · 1 comment
Closed

unexpected propagation of <const> attribute #759

fperrad opened this issue Jul 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@fperrad
Copy link
Contributor

fperrad commented Jul 7, 2024

local utf8 = utf8
if not utf8 then
   local ok, lutf8 = pcall(require, 'lua-utf8')
   if ok then
      utf8 = lutf8  -- Error: cannot assign to <const> variable
   end
end

The global utf8 has the attribute.
But the local utf8 inherits of this attribute.

$ tl check const.tl 
========================================
2 errors:
const.tl:3:27: module not found: 'lua-utf8'
const.tl:5:7: cannot assign to <const> variable
@hishamhm hishamhm added the bug Something isn't working label Jul 22, 2024
hishamhm added a commit that referenced this issue Aug 7, 2024
This allows for a pattern where we can localize a record
and load and alternative implementation on top of it.

Fixes #759.
@hishamhm
Copy link
Member

hishamhm commented Aug 7, 2024

@fperrad I fixed this in the next branch! It should now allow the pattern that you described. (See testcase in 181d2a5).

I haven't been backporting fixes to master because I'm really in the final stretch for the next branch (hoping to release Sep/Oct). Could you give next a try?

(Also, if you're using --gen-compat then utf8 compatibility should come for free via compat-5.3 — but IIRC you're not using it because of the bit operations? Is that the case?)

Thank you for the report!

@hishamhm hishamhm closed this as completed Aug 7, 2024
hishamhm added a commit that referenced this issue Aug 15, 2024
This allows for a pattern where we can localize a record
and load and alternative implementation on top of it.

Fixes #759.
hishamhm added a commit that referenced this issue Aug 19, 2024
This allows for a pattern where we can localize a record
and load and alternative implementation on top of it.

Fixes #759.
hishamhm added a commit that referenced this issue Aug 21, 2024
This allows for a pattern where we can localize a record
and load and alternative implementation on top of it.

Fixes #759.
hishamhm added a commit that referenced this issue Aug 26, 2024
This allows for a pattern where we can localize a record
and load and alternative implementation on top of it.

Fixes #759.
hishamhm added a commit that referenced this issue Aug 31, 2024
This allows for a pattern where we can localize a record
and load and alternative implementation on top of it.

Fixes #759.
hishamhm added a commit that referenced this issue Oct 7, 2024
This allows for a pattern where we can localize a record
and load and alternative implementation on top of it.

Fixes #759.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants