polystat / odin

Object Dependency Inspector
10 stars 2 forks source link

(3rd type) An error in the long chain of call #35

Closed APotyomkin closed 2 years ago

APotyomkin commented 2 years ago

Problematic code

[] > test
  [] > parent
    [self x] > f
      x.sub 5 > t
      seq > @
        assert (0.less t)
        x

    [self y1] > g
      self.f self y1 > @

    [self y2] > gg
      self.g self y2 > @

    [self y3] > ggg
      self.gg self y3 > @

    [self z] > h
      z > @
  [] > child
    test.parent > @
    [self y] > f
      y > @
    [self z] > h
      self.ggg self z > @

Expected result

RESULT BY AnOdin:
        [Unjustified Assumption] Method g is not referentially transparent

Actual result

RESULT BY AnOdin:
        Odin is not able to analyze the code, due to:
        Symbol value-of-before-f not declared

Assumption

I suppose that it is somehow related to a length of a calls chain.(not confirmed based on #36) With shortened chain, it works well.

Code

[] > test
  [] > parent
    [self x] > f
      x.sub 5 > t
      seq > @
        assert (0.less t)
        x

    [self y1] > g
      self.f self y1 > @

    [self y2] > gg
      self.g self y2 > @

    [self z] > h
      z > @
  [] > child
    test.parent > @
    [self y] > f
      y > @
    [self z] > h
      self.gg self z > @

Results

RESULT BY AnOdin:
        [Unjustified Assumption] Method g is not referentially transparent
fizruk commented 2 years ago

@Leosimetti as discussed, we need to use define-funs-rec to enable (mutually) recursive definitions of function values and function properties.