mirror of
https://github.com/irmen/prog8.git
synced 2025-07-23 13:24:32 +00:00
fixed weird error messages when attempting to create variable with type long
This commit is contained in:
@@ -722,7 +722,7 @@ internal class AstChecker(private val program: Program,
|
|||||||
throw InternalCompilerException("vardecls with multiple names should have been converted into individual vardecls")
|
throw InternalCompilerException("vardecls with multiple names should have been converted into individual vardecls")
|
||||||
|
|
||||||
if(decl.datatype==DataType.LONG && decl.type!=VarDeclType.CONST)
|
if(decl.datatype==DataType.LONG && decl.type!=VarDeclType.CONST)
|
||||||
errors.err("integer overflow", decl.position)
|
errors.err("cannot use long type for variables; only for constants", decl.position)
|
||||||
if(decl.type==VarDeclType.MEMORY) {
|
if(decl.type==VarDeclType.MEMORY) {
|
||||||
if (decl.datatype == DataType.BOOL || decl.datatype == DataType.ARRAY_BOOL)
|
if (decl.datatype == DataType.BOOL || decl.datatype == DataType.ARRAY_BOOL)
|
||||||
errors.err("variables mapped in memory should be numeric", decl.position)
|
errors.err("variables mapped in memory should be numeric", decl.position)
|
||||||
@@ -1956,6 +1956,7 @@ internal class AstChecker(private val program: Program,
|
|||||||
DataType.UBYTE -> sourceDatatype == DataType.UBYTE
|
DataType.UBYTE -> sourceDatatype == DataType.UBYTE
|
||||||
DataType.WORD -> sourceDatatype in setOf(DataType.BYTE, DataType.UBYTE, DataType.WORD)
|
DataType.WORD -> sourceDatatype in setOf(DataType.BYTE, DataType.UBYTE, DataType.WORD)
|
||||||
DataType.UWORD -> sourceDatatype == DataType.UBYTE || sourceDatatype == DataType.UWORD
|
DataType.UWORD -> sourceDatatype == DataType.UBYTE || sourceDatatype == DataType.UWORD
|
||||||
|
DataType.LONG -> sourceDatatype in IntegerDatatypes
|
||||||
DataType.FLOAT -> sourceDatatype in NumericDatatypes
|
DataType.FLOAT -> sourceDatatype in NumericDatatypes
|
||||||
DataType.STR -> sourceDatatype == DataType.STR
|
DataType.STR -> sourceDatatype == DataType.STR
|
||||||
else -> false
|
else -> false
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
fix weird error messages for long vars long @shared foo2 = 123456
|
|
||||||
|
|
||||||
what to do with bnk(): it's an awkward name but bank() is too general a name and will forbid you to use 'bank' as a variable...
|
what to do with bnk(): it's an awkward name but bank() is too general a name and will forbid you to use 'bank' as a variable...
|
||||||
add a function like addr() or lsw() to complement bnk() in getting easy access to the lower 16 bits of a long integer?
|
add a function like addr() or lsw() to complement bnk() in getting easy access to the lower 16 bits of a long integer?
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
long @shared foo2 = 123456
|
long @shared foo2 = 22
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user