|
@@ -573,8 +573,8 @@ export class SemanticAnalyser {
|
|
const access_type = typeInfo.type;
|
|
const access_type = typeInfo.type;
|
|
|
|
|
|
let compatible = false;
|
|
let compatible = false;
|
|
|
|
+ let type = access_type;
|
|
if (exp_type instanceof MultiType) {
|
|
if (exp_type instanceof MultiType) {
|
|
- let type = access_type;
|
|
|
|
if (access_type.dimensions - used_dims == 0) {
|
|
if (access_type.dimensions - used_dims == 0) {
|
|
type = access_type.innerType;
|
|
type = access_type.innerType;
|
|
} else {
|
|
} else {
|
|
@@ -588,9 +588,12 @@ export class SemanticAnalyser {
|
|
compatible = access_type.canAccept(exp_type, used_dims);
|
|
compatible = access_type.canAccept(exp_type, used_dims);
|
|
}
|
|
}
|
|
if (!compatible) {
|
|
if (!compatible) {
|
|
|
|
+ if (0 === access_type.dimensions - used_dims) {
|
|
|
|
+ type = access_type.innerType; // enable a valid attempt to cast real <--> integer
|
|
|
|
+ }
|
|
if (
|
|
if (
|
|
!Config.enable_type_casting ||
|
|
!Config.enable_type_casting ||
|
|
- !Store.canImplicitTypeCast(access_type, exp_type)
|
|
|
|
|
|
+ !Store.canImplicitTypeCast(type, exp_type)
|
|
) {
|
|
) {
|
|
const access_type_string_info = access_type.stringInfo();
|
|
const access_type_string_info = access_type.stringInfo();
|
|
const access_type_info = access_type_string_info[0];
|
|
const access_type_info = access_type_string_info[0];
|
|
@@ -918,7 +921,7 @@ export class SemanticAnalyser {
|
|
(!resultType.isCompatible(Types.INTEGER) &&
|
|
(!resultType.isCompatible(Types.INTEGER) &&
|
|
!resultType.isCompatible(Types.REAL)) ||
|
|
!resultType.isCompatible(Types.REAL)) ||
|
|
formalParam.type.isCompatible(Types.INTEGER) ||
|
|
formalParam.type.isCompatible(Types.INTEGER) ||
|
|
- formalParam.type.isCompatible(Types.REAL)
|
|
|
|
|
|
+ formalParam.type.isCompatible(Types.REAL)
|
|
) {
|
|
) {
|
|
throw ProcessorErrorFactory.invalid_parameter_type_full(
|
|
throw ProcessorErrorFactory.invalid_parameter_type_full(
|
|
fun.name,
|
|
fun.name,
|
|
@@ -935,7 +938,7 @@ export class SemanticAnalyser {
|
|
(!resultType.isCompatible(Types.INTEGER) &&
|
|
(!resultType.isCompatible(Types.INTEGER) &&
|
|
!resultType.isCompatible(Types.REAL)) ||
|
|
!resultType.isCompatible(Types.REAL)) ||
|
|
formalParam.type.isCompatible(Types.INTEGER) ||
|
|
formalParam.type.isCompatible(Types.INTEGER) ||
|
|
- formalParam.type.isCompatible(Types.REAL)
|
|
|
|
|
|
+ formalParam.type.isCompatible(Types.REAL)
|
|
) {
|
|
) {
|
|
throw ProcessorErrorFactory.invalid_parameter_type_full(
|
|
throw ProcessorErrorFactory.invalid_parameter_type_full(
|
|
fun.name,
|
|
fun.name,
|