neilsf / xc-basic3

A BASIC cross compiler for MOS 6502-based machines
MIT License
42 stars 5 forks source link

[3.1.5] "Variable used in NEXT statement must match variable used in FOR statement" on line 1, which isn't true #232

Closed JJFlash-IT closed 1 year ago

JJFlash-IT commented 1 year ago

XC=BASIC compiler version v3.1.5 (Jun 29 2023) (On Windows 7 and Windows 10, 64bit)

I upgraded from version 3.1.2 straight to 3.1.5, then I tried to compile my latest project with it.

It turned out I can't, because of the error I mentioned in this issue's title.

There are two problems:

  1. I believe that the problem mentioned in the error message isn't actually there, otherwise I couldn't have compiled it successfully with 3.1.2, and;
  2. It says that the error is on line 1, which is "OPTION INLINEDATA", so it's certainly not true.

The second problem was already there with 3.1.2. While I was completing the game, the compiler suddenly stopped being able to tell me the actual line where there was a problem, and it always told me line 1. Because of this, I have no idea what the NEXT-FOR error message is referring to.

I made sure that all the files involved have all their lines correctly terminated with CR+LF, by using an Hex Editor and searching for the sequence 0D 0A. So it must be something else.

For your convenience, I'm including all the files here straight from my PC, zipped so that there's no CRLF conversion whatsoever: Advent_101.zip

I hope you can reproduce the problem and find the cause (which I'm curious about) and also a solution.

Thank you as always!

neilsf commented 1 year ago

Fixed in https://github.com/neilsf/xc-basic3/releases/tag/v3.1.6 Thanks again for the bug report!