Asfianda / agk

Automatically exported from code.google.com/p/agk
0 stars 0 forks source link

Single-line array declaration not functional in 1088 beta #468

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run the following statements in the compiler. Some simply do not work while 
others give errors (noted below)

[CODE]
// Testing array declarations
    //single line initialization fails for all variable types
    dim test_array1[3] as string = ["a","b","c"]

    dim test_array2[3] as integer = [10,11,12]

    dim test_array3[3] as float = [1.01,1.02,1.03]

    REMSTART
    // gives error "Cannot perform cast type integer on test_array4"
    dim test_array4[3] as string
    test_array4 = ["a","b","c"]

    // "Declaration value 10,11,12 is not legal"
    dim test_array5[3] = [10,11,12]
    REMEND

    dim test_array6[3] as string
    test_array6[0] = "a"
    test_array6[1] = "b"
    test_array6[2] = "c"

do
    for i = 1 to 3
        print(test_array1[i-1])
    next i

    for i = 1 to 3
        print(test_array2[i-1])
    next i

    for i = 1 to 3
        print(test_array3[i-1])
    next i

    REMSTART
    // gives error "Cannot perform cast type integer on test_array4"
    for i = 1 to 3
        print(test_array4[i-1])
    next i
    REMEND

    REMSTART
    // "Declaration value 10,11,12 is not legal"
    for i = 1 to 3
        print(test_array5[i-1])
    next i
    REMEND

    for i = 1 to 3
        print(test_array6[i-1])
    next i
    Sync()
loop
[/CODE]

What is the expected output? What do you see instead?
Output should be what has been declared as array elements, but is instead null 
or zeroes.

What version of the product are you using? On what operating system?
1088 beta on Windows 7

Thanks!

Original issue reported on code.google.com by manns41...@gmail.com on 16 Jan 2013 at 1:17

GoogleCodeExporter commented 9 years ago
This apparently got broken in the v108 betas.  It stopped working as of v1082 
(I don't think we saw v1080 thru v1081).

This is confirmed.

Cheers,
Ancient Lady
TGC AGK Community Tester

Original comment by lady...@triassicassociates.com on 16 Jan 2013 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by P.S.John...@gmail.com on 29 Jan 2013 at 1:12

GoogleCodeExporter commented 9 years ago
It's sort of funny that this is broken (again), while even the online 
documentation says that these forms of array initializations are allowed.

See online docs here:
http://www.appgamekit.com/documentation/language/5_dim.htm

Further discussion of this issue can be found here:
http://forum.thegamecreators.com/?m=forum_view&t=205700&b=41

Original comment by agentsam...@gmail.com on 27 May 2013 at 10:54

GoogleCodeExporter commented 9 years ago
A further note on this that gave me about 2 hours of headache is that (as of 
10813 and 10814) if you declare an array like this:
dim myArray[10] = 1
Then the compiler completely freaks out and gives you random errors about other 
parts of your code. Really hope that stuff like this is fixed in the final v1 
build.

Original comment by manns41...@gmail.com on 12 Jul 2013 at 1:13

GoogleCodeExporter commented 9 years ago
Fixed in AGK version 2.0

Original comment by P.S.John...@gmail.com on 22 Aug 2014 at 7:20