New Issue: [Bug]: Returning a field as reference of the wrong type causes internal error

25596, "DanilaFe", "[Bug]: Returning a field as reference of the wrong type causes internal error", "2024-07-17T21:25:41Z"

The following program causes an internal error:

record rec {
  var A: int;

  proc this() ref : real {
    return A;
  }
}

var r = new rec();
writeln(r());

The program shouldn't compile; the field A is being returned as a real, but it's a field of type int. However, I would not expect an internal error, but an error message in the form:

Initializing a reference with another type

Or something like that.