tokiwa-software / fuzion

The Fuzion Language Implementation
https://fuzion-lang.dev
GNU General Public License v3.0
46 stars 11 forks source link

Unexpected: Incompatible types in assignment #197

Open michaellilltokiwa opened 2 years ago

michaellilltokiwa commented 2 years ago

this example:

ex =>
  my_array<T> is
    my_map<B> my_array<B> is
      my_array<B>
    f (ms my_array<Monoid<T>>) my_array<T> is
      ms.my_map<T>

yields:

...fz:6:10: error 1: Incompatible types in assignment
      ms.my_map<T>
---------^
assignment to field : 'ex.my_array.f.result'
expected formal type: 'ex.my_array<ex.my_array.T>'
actual type found   : 'ex.my_array<Monoid<ex.my_array.T>>'
assignable to       : 'ex.my_array<Monoid<ex.my_array.T>>'
for value assigned  : '{
  f.this.ms.my_map<ex.my_array.T>
}'
To solve this, you could change the type of the target 'ex.my_array.f.result' to 'ex.my_array<Monoid<ex.my_array.T>>' or convert the type of the assigned value to 'ex.my_array<ex.my_array.T>'.

one error.
michaellilltokiwa commented 1 year ago

updated syntax

ex =>
  my_array(T type) is
    my_map(B type) my_array B is
      my_array B
    f (ms my_array (Monoid T)) my_array T is
      ms.my_map T