Skip to content

Type-checking error when there is a function with body #374

@thanhnguyen-aws

Description

@thanhnguyen-aws

The following program raises a type-checking error:

def smalltest :=
#strata
program Core;

function bool_to_int (b: bool) : int {if b then 1 else 0}
function str_to_bool (s: string) : bool;

procedure test () returns ()
{
  var b: string, i: int;
  i := bool_to_int(str_to_bool(b));
};

#end

The error is

(0,(0-0)) ❌ Type checking error.
Impossible to unify string with bool.

But the when we rename the variable b in procedure test or function bool_to_int (only 1 of them, just to make the names different), then there is no error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions