mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
slightly less strict
This commit is contained in:
parent
0e17a0474a
commit
96b5a30f60
@ -1058,12 +1058,12 @@ internal class AstChecker(private val program: Program,
|
||||
} else {
|
||||
if(expr.left is TypecastExpression && expr.right is NumericLiteral && !expr.right.inferType(program).istype(DataType.FLOAT)) {
|
||||
val origLeftDt = (expr.left as TypecastExpression).expression.inferType(program).getOr(DataType.UNDEFINED)
|
||||
if(!origLeftDt.equalsSize(rightDt))
|
||||
if(rightDt.largerThan(origLeftDt) && !(expr.right as NumericLiteral).cast(origLeftDt).isValid)
|
||||
errors.err("operands are not the same type", expr.right.position)
|
||||
}
|
||||
if(expr.right is TypecastExpression && expr.left is NumericLiteral && !expr.left.inferType(program).istype(DataType.FLOAT)) {
|
||||
val origRightDt = (expr.right as TypecastExpression).expression.inferType(program).getOr(DataType.UNDEFINED)
|
||||
if(!origRightDt.equalsSize(leftDt))
|
||||
if(leftDt.largerThan(origRightDt) && !(expr.left as NumericLiteral).cast(origRightDt).isValid)
|
||||
errors.err("operands are not the same type", expr.right.position)
|
||||
}
|
||||
}
|
||||
|
@ -5,40 +5,15 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
ubyte[256] @shared arr1 = 99
|
||||
ubyte[256] @shared arr2 = 0
|
||||
uword[128] @shared warr1 = 9999
|
||||
uword[128] @shared warr2 = 0
|
||||
ubyte @shared pointer
|
||||
const uword value = 255
|
||||
|
||||
txt.print_ub(all(arr2))
|
||||
txt.nl()
|
||||
txt.print_ub(all(warr2))
|
||||
txt.nl()
|
||||
arr2 = arr1
|
||||
warr2 = warr1
|
||||
txt.print_ub(all(arr2))
|
||||
txt.nl()
|
||||
txt.print_ub(all(warr2))
|
||||
txt.nl()
|
||||
|
||||
|
||||
uword[] @split cave_times = [1111,2222,3333,4444]
|
||||
cave_times = [9999,8888,7777,6666]
|
||||
|
||||
for cx16.r0L in 0 to len(cave_times)-1 {
|
||||
txt.print_uw(cave_times[cx16.r0L])
|
||||
txt.spc()
|
||||
if pointer>value {
|
||||
cx16.r0L++
|
||||
}
|
||||
txt.nl()
|
||||
|
||||
ubyte[] cave_times2 = [11,22,33,44]
|
||||
cave_times2 = [99,88,77,66]
|
||||
|
||||
for cx16.r0L in 0 to len(cave_times2)-1 {
|
||||
txt.print_ub(cave_times2[cx16.r0L])
|
||||
txt.spc()
|
||||
if pointer>50000 {
|
||||
cx16.r0L++
|
||||
}
|
||||
txt.nl()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user