fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

`Outer.this` in type feature results in confusing error

Open fridis opened this issue 8 months ago • 0 comments

This is related to #5114, but should be fixed after #5114 since I am not sure if #5114 can still be reproduced after this was fixed.

Take this code

A is
  type.x => A.this

which results in an error that is a little confusing:

 > ./build/bin/fz test_fail_A_this.fz

/home/fridi/fuzion/clean/fuzion/test_fail_A_this.fz:2:13: error 1: Could not find outer feature in '.this'-expression
  type.x => A.this

Within feature: 'A.type.x'
Outer feature that was not found: 'A'
Outer features available: 'x.this', 'A.#type.x.this', 'A.#type.this'

one error.

First, one cannot replace A.this by A.#type.this or A.#type.x.this to make this work. Also, it does not work to use A.type.this or A.type.x.this

As a simple solutions, we could just suppress A.#type.this abd A.#type.x.this in the error message.

A more sophisticated solution could permit A.type.this (resulting in the outer type feature instance, which might be a child of A) and A.type.x.this (resulting in x.this).

fridis avatar Apr 23 '25 13:04 fridis