Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find division by zero in presence of mutual recursion #22

Open
APotyomkin opened this issue Nov 13, 2021 · 0 comments
Open

Cannot find division by zero in presence of mutual recursion #22

APotyomkin opened this issue Nov 13, 2021 · 0 comments

Comments

@APotyomkin
Copy link

Problematic code:

foo.eo:

+package sandbox
+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf
+alias mutual_rec sandbox.mutual_rec

[] > foo
  mutual_rec > @
  [self v] > f
    self.g > @
      self
      a 0
  [x] > a
    div. > @
      5
      x

mutual_rec.eo

+package sandbox
+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf

[] > mutual_rec
  memory > x
  [self v] > f
    x.write > @
      v
  [self v] > g
    self.f > @
      self
      v

Expected output:

Division by zero detected

Actual output:

No errors
Warning
  XTDE0540: Ambiguous rule match for /objects/o[1]/o[2]/o[1]
Matches both "element(Q{}o)[((empty(attribute::attribute(Q{}base))) and
  (exists(attribute::attribute(Q{}name)))) and
  ((data(parent::element(Q{}o)/attribute::attribute(Q{}line))) = data(@line))]" on line 53 of
and "element(Q{}o)[empty(attribute::attribute(Q{}base))]" on line 42 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[1]/o[2]/o[2]
Matches both "element(Q{}o)[((empty(attribute::attribute(Q{}base))) and
  (exists(attribute::attribute(Q{}name)))) and
  ((data(parent::element(Q{}o)/attribute::attribute(Q{}line))) = data(@line))]" on line 53 of
and "element(Q{}o)[empty(attribute::attribute(Q{}base))]" on line 42 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[1]/o[3]/o[1]
Matches both "element(Q{}o)[((empty(attribute::attribute(Q{}base))) and
  (exists(attribute::attribute(Q{}name)))) and
  ((data(parent::element(Q{}o)/attribute::attribute(Q{}line))) = data(@line))]" on line 53 of
and "element(Q{}o)[empty(attribute::attribute(Q{}base))]" on line 42 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[1]/o[3]/o[2]
Matches both "element(Q{}o)[((empty(attribute::attribute(Q{}base))) and
  (exists(attribute::attribute(Q{}name)))) and
  ((data(parent::element(Q{}o)/attribute::attribute(Q{}line))) = data(@line))]" on line 53 of
and "element(Q{}o)[empty(attribute::attribute(Q{}base))]" on line 42 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[2]/o[2]/o[1]
Matches both "element(Q{}o)[((empty(attribute::attribute(Q{}base))) and
  (exists(attribute::attribute(Q{}name)))) and
  ((data(parent::element(Q{}o)/attribute::attribute(Q{}line))) = data(@line))]" on line 53 of
and "element(Q{}o)[empty(attribute::attribute(Q{}base))]" on line 42 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[2]/o[2]/o[2]
Matches both "element(Q{}o)[((empty(attribute::attribute(Q{}base))) and
  (exists(attribute::attribute(Q{}name)))) and
  ((data(parent::element(Q{}o)/attribute::attribute(Q{}line))) = data(@line))]" on line 53 of
and "element(Q{}o)[empty(attribute::attribute(Q{}base))]" on line 42 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[2]/o[2]/o[3]/o[3]/o[1]
Matches both "element(Q{}o)[attribute::attribute(Q{}data)]" on line 58 of
and "element(Q{}o)[(exists(attribute::attribute(Q{}base))) and
  (not(starts-with(convertUntyped(data(@base)), ".")))]" on line 26 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[2]/o[3]/o[1]
Matches both "element(Q{}o)[((empty(attribute::attribute(Q{}base))) and
  (exists(attribute::attribute(Q{}name)))) and
  ((data(parent::element(Q{}o)/attribute::attribute(Q{}line))) = data(@line))]" on line 53 of
and "element(Q{}o)[empty(attribute::attribute(Q{}base))]" on line 42 of
Warning
  XTDE0540: Ambiguous rule match for /objects/o[2]/o[3]/o[2]/o[1]
Matches both "element(Q{}o)[attribute::attribute(Q{}data)]" on line 58 of
and "element(Q{}o)[(exists(attribute::attribute(Q{}base))) and
  (not(starts-with(convertUntyped(data(@base)), ".")))]" on line 26 of
Error: Method `mutual_rec.g` is mutually recursive with method `foo.f` through the following possible code path:
mutual_rec.g -> foo.f -> mutual_rec.g
Error: Method `foo.f` is mutually recursive with method `mutual_rec.g` through the following possible code path:
foo.f -> mutual_rec.g -> foo.f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant