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

bug(developer): kmc-kmn kmw compiler generates an incorrect offset for nul ... > index(store,n) when in v10+ mode #13307

Open
1 task
mcdurdin opened this issue Feb 21, 2025 · 0 comments · May be fixed by #13326
Assignees
Milestone

Comments

@mcdurdin
Copy link
Member

mcdurdin commented Feb 21, 2025

store(&version) '10.0'
store(&TARGETS) 'any'

begin Unicode > use(main)

store(cons) 'mnpqrstv'

group(main) using keys

nul any(cons) + 'e' > '5' index(cons,2)

With this keyboard in Keyman Core 15.0 or later (e.g. debugger, Keyman for Windows), try typing: te

  • The output should be 5t.
  • For KeymanWeb v9 mode, the output is: 5t (correct).

Bugs:

  • For KeymanWeb v10 mode, the output is: 5.

This issue is present in Keyman Core 15.0 and later versions. I have not tested earlier versions.

Note that using index(cons,1) gives a compiler error which makes total sense:

test_13276.kmn (20): Error: 4032 An index() in the output does not have a corresponding any() statement

I have tested the same pattern with if() and it works correctly in Keyman Core, KeymanWeb v9 mode, and KeymanWeb v10 mode.

Related issues:

@mcdurdin mcdurdin added this to the B18S2 milestone Feb 21, 2025
@mcdurdin mcdurdin self-assigned this Feb 21, 2025
@mcdurdin mcdurdin added this to Keyman Feb 21, 2025
@mcdurdin mcdurdin moved this to Todo in Keyman Feb 21, 2025
@mcdurdin mcdurdin changed the title bug(common): nul, any, and index() have an off-by-one error bug(developer): nul, any, and index() have an off-by-one error in kmc-kmn:kmw v10 compiler Feb 21, 2025
@mcdurdin mcdurdin changed the title bug(developer): nul, any, and index() have an off-by-one error in kmc-kmn:kmw v10 compiler bug(developer): kmc-kmn kmw compiler generates an incorrect offset for nul ... > index(store,n) when in v10+ mode Feb 21, 2025
mcdurdin added a commit that referenced this issue Feb 23, 2025
…iler

The cached context comparison for v10 kmw compiler includes the `nul`
statement, unlike the comparison in the earlier compiler. This
difference was missed in earlier iterations including the recent patch
in #13003. This patch fixes the problem for both `context(n)` and
`index(store,n)` offset calculations.

Fixes: #13306
Fixes: #13307
Follows: 13003
mcdurdin added a commit that referenced this issue Feb 23, 2025
…iler

The cached context comparison for v10 kmw compiler includes the `nul`
statement, unlike the comparison in the earlier compiler. This
difference was missed in earlier iterations including the recent patch
in #13003. This patch fixes the problem for both `context(n)` and
`index(store,n)` offset calculations.

Fixes: #13306
Fixes: #13307
Follows: #13003
@mcdurdin mcdurdin moved this from Todo to In Progress in Keyman Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

1 participant