2015 bug: Error message on incorrect line

Debug the code below and the compile will break with a single Type Mismatch error on line 7. The error type is correct, but it’s on the wrong line number. The error is in line 8, not 7.

[code]
dim i as Integer = 1
dim s as string = “testing 3”
dim teststring as string

teststring = “testing 1 (” + _
"testing 2, " + _
s + “,” + _
i + " " + _
“)”
MsgBox s[/code]

There’s an old <https://xojo.com/issue/19674> but it shows as fixed in 2012.

Tested with 2015R1 and 2015R2B2. 2014R2.1 show 3 errors on the above code, but one of them is at least on the correct line number.

Added a new feedback: <https://xojo.com/issue/38600>

Well I’m not sure this is wrong. The error isn’t the i, the error is the +, which is on line 7. It does want an string argument, which the i is not.

Put the concatenation operators at the beginning of the line:

[code]dim i as Integer = 1
dim s as string = “testing 3”
dim teststring as string

teststring = “testing 1 (” _

  • "testing 2, " _
  • s + “,” _
  • i + " " _
  • “)”
    MsgBox s[/code]

[quote=174430:@Tanner Lee]Debug the code below and the compile will break with a single Type Mismatch error on line 7. The error type is correct, but it’s on the wrong line number. The error is in line 8, not 7.

[code]
dim i as Integer = 1
dim s as string = “testing 3”
dim teststring as string

teststring = “testing 1 (” + _
"testing 2, " + _
s + “,” + _
i + " " + _
“)”
MsgBox s[/code]

There’s an old <https://xojo.com/issue/19674> but it shows as fixed in 2012.

Tested with 2015R1 and 2015R2B2. 2014R2.1 show 3 errors on the above code, but one of them is at least on the correct line number.[/quote]

As Eli said, the error is being triggered on he previous + because you can’t concat an integer to a string. This is not a bug.

The error was intentional to demonstrate my issue.

That works nicely. Thank you.