Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: the type of this expression is underspecified #1325

Open
sorawee opened this issue Jul 25, 2021 · 1 comment
Open

Error: the type of this expression is underspecified #1325

sorawee opened this issue Jul 25, 2021 · 1 comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking

Comments

@sorawee
Copy link
Contributor

sorawee commented Jul 25, 2021

Unless I missed something, this program should be verified fine:

method Main () {
  var arr := [[1]];
  var x := |((arr + arr) + (arr + arr))|;
}

but it results in Error: the type of this expression is underspecified.

Subtle changes to the program make it verified:

method Main () {
  var arr := [[1]];
  var x := |(arr + (arr + (arr + arr)))|;
}

or

method Main () {
  var arr := [[1]];
  var x := ((arr + arr) + (arr + arr));
  var y := |x|;
}

EDITED: a more minimal example:

method Main () {
  var x := [1];
  print (x + x) + (x + x);
}
@robin-aws robin-aws added kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking labels Aug 27, 2021
@robin-aws
Copy link
Member

I'm calling this a bug since it's really hard for users to explain why type inference fails on this exact expression and not the others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label part: resolver Resolution and typechecking
Projects
None yet
Development

No branches or pull requests

2 participants