Fix parser bug where list = anytype was accepted. Fix also the test suite.
This commit is contained in:
@@ -862,11 +862,7 @@ list lazy_list_set(list L, integer i, list v)
|
|||||||
# Lots of drama for checking types. This is pretty much like
|
# Lots of drama for checking types. This is pretty much like
|
||||||
# addition, subtraction, multiply, divide, etc. all in one go.
|
# addition, subtraction, multiply, divide, etc. all in one go.
|
||||||
if tok0 == '=':
|
if tok0 == '=':
|
||||||
if typ == 'list' != rtyp:
|
expr = self.autocastcheck(expr, typ)
|
||||||
if self.explicitcast:
|
|
||||||
expr = {'nt':'CAST', 't':typ, 'ch':[expr]}
|
|
||||||
else:
|
|
||||||
expr = self.autocastcheck(expr, typ)
|
|
||||||
|
|
||||||
return {'nt':'=', 't':typ, 'ch':[lvalue, expr]}
|
return {'nt':'=', 't':typ, 'ch':[lvalue, expr]}
|
||||||
|
|
||||||
@@ -874,7 +870,7 @@ list lazy_list_set(list L, integer i, list v)
|
|||||||
if typ == 'float':
|
if typ == 'float':
|
||||||
expr = self.autocastcheck(expr, typ)
|
expr = self.autocastcheck(expr, typ)
|
||||||
if rtyp != typ != 'list' or typ == rtyp == 'key':
|
if rtyp != typ != 'list' or typ == rtyp == 'key':
|
||||||
# key + key is the only disallowed combo of equals
|
# key + key is the only disallowed combo of equal types
|
||||||
raise EParseTypeMismatch(self)
|
raise EParseTypeMismatch(self)
|
||||||
if self.explicitcast:
|
if self.explicitcast:
|
||||||
if typ == 'list' != rtyp:
|
if typ == 'list' != rtyp:
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ class Test02_Parser(UnitTestCase):
|
|||||||
1+([]+(integer)~1);
|
1+([]+(integer)~1);
|
||||||
list a;
|
list a;
|
||||||
float f;
|
float f;
|
||||||
a = 3; a += 3;
|
a = (list)3; a += 3;
|
||||||
f += 4; f += -4.3;
|
f += 4; f += -4.3;
|
||||||
integer i;
|
integer i;
|
||||||
i *= 1.3;
|
i *= 1.3;
|
||||||
@@ -297,7 +297,7 @@ class Test03_Optimizer(UnitTestCase):
|
|||||||
integer j = 3||4&&5|6^7&8.==9!=10.e+01f<11<=12>13.>=14<<15>>16==0&&3==
|
integer j = 3||4&&5|6^7&8.==9!=10.e+01f<11<=12>13.>=14<<15>>16==0&&3==
|
||||||
++f-f++-(3 + llFloor(f)<<3 << 32) - 2 - 0;
|
++f-f++-(3 + llFloor(f)<<3 << 32) - 2 - 0;
|
||||||
integer k = 2 + (3 * 25 - 4)/2 % 9;
|
integer k = 2 + (3 * 25 - 4)/2 % 9;
|
||||||
a = 3; a += !3;
|
a = (list)3; a += !3;
|
||||||
f += 4; f += -4.3;
|
f += 4; f += -4.3;
|
||||||
integer i;
|
integer i;
|
||||||
i = llGetListLength(L);
|
i = llGetListLength(L);
|
||||||
|
|||||||
Reference in New Issue
Block a user