Bug? Unexpected @ in program

ema01

Member
Licensed User
Longtime User
Hello, i too have faced the issue of "unexpected @ in program"

Situation:
-I receive a byte array from BLE
-The byte array is converted to a Int array
-Select Case with the first element of the array yeld the unexpected @ problem
-Line showing the issue is a Select Case that has only a Case Else (because the code is derived from a simillar class used in another app, the next version of the app will have cases)

B4X:
Public Sub newData(bData() As Byte)    
    'Convert Byte Data to INT data
    Dim data(bData.Length) As Int
    For idx = 0 To data.Length-1
        data(idx) = Bit.And(bData(idx),0xFF)
    Next
   
    'Pick data size depending on first byte
    Select Case data(0) 'This line is translated to switch ([self.bi switchObjectToInt:@(((NSNumber*)[_data getObjectFastN:(int) (0)]).intValue) :@]]) {
        case else
            ...
    End Select

    ...
End Sub

I can work around the problem by declaring a "data0" Int, assigning data(0) and then using this new variable.
The problem is not triggered If the select case has at least one case other than case else
 

ema01

Member
Licensed User
Longtime User
Yes, in this case the select is redundant, but IMHO the compiler should be able to see it and act accordingly.
The reason why i think there is a bug in the translation between basic an objective-c is because a select case with only the case else is legal, also all the other mentions of the "@" problem i could find were pointing to a problem in the select case translation
 
Top