fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

post condition of abstract feature cannot access `result`

Open fridis opened this issue 1 year ago • 0 comments

A post condition in an abstract feature should be able to say something about the result:

test_post is
  f i32
    post
      result > 0
    => abstract

but this results in an error

 > ./build/bin/fz test_post.fz

/home/fridi/fuzion/work/test_post.fz:4:7: error 1: Could not find called feature
      result > 0
------^^^^^^
Feature not found: 'result' (no arguments)
Target feature: 'test_post.f'
In call: 'result'
To solve this, make sure you declare a return type in the surrounding feature such that the 'result' field will be declared automatically.


<built-in>: error 2: A expression of a contract must result in bool.
To solve this, change the expression to return a bool.

2 errors.

fridis avatar May 03 '24 09:05 fridis