not sure if my question made it through 😆 . I was asking if the root of the problem is the type-resolver which forces you to such differentiated checks. (the problem as in, why are such specific checks necessary, while I expected the type-resolver to see that problem clearly).
i tested this quickly:
#[test]
fn super_and_this() {
let src =
"
FUNCTION_BLOCK parent
VAR
y : INT := 20;
END_VAR
END_FUNCTION_BLOCK
FUNCTION_BLOCK child EXTENDS parent
VAR
x : INT := 10;
px : POINTER TO child;
END_VAR
{{px^}.x};
{{px}.x};
{{this^}.x} := 50;
{{this}.x} := 50;
{{super}.x};
{super^.x}; // super^ seams to be special?! the expression collector fails to collect super^
END_FUNCTION_BLOCK
";
let resolves = test_resolve(src).unwrap();
assert_snapshot!(resolves, @r###"
EXPR | TYPE | HINT
----------+--------------+------
px^.x | INT | - - OK
px^ | child | - - OK
px.x | - | - - OK
px | __child_px | - - OK
this^.x | INT | - - OK
this^ | child | - - OK
this.x | INT | - - surprising!!
this | child.__THIS | - - OK
super.x | INT | - - surprising!!
super | - | - - surprisnig!! (would have expected similar behavior like this)
super^.x | INT | - - OK
"###);
}
it is also strange that the expression-collector seams to fail to collect super^ as an expression and type-resolve it. adding {super^} fails while {px^} and {this^} work fine - very strange.
❓ so what I wanted to discuss was, is this differentiation of a px, this and super intended and actually helpful?
Originally posted by @riederm in #1729 (comment)
not sure if my question made it through 😆 . I was asking if the root of the problem is the type-resolver which forces you to such differentiated checks. (the problem as in, why are such specific checks necessary, while I expected the type-resolver to see that problem clearly).
i tested this quickly:
it is also strange that the expression-collector seams to fail to collect
super^as an expression and type-resolve it. adding{super^}fails while{px^}and{this^}work fine - very strange.❓ so what I wanted to discuss was, is this differentiation of a
px,thisandsuperintended and actually helpful?Originally posted by @riederm in #1729 (comment)