Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Mar 29, 2024
2 parents df19bfc + ecb10c9 commit 015b348
Show file tree
Hide file tree
Showing 12 changed files with 222 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ xsls:
tests:
- /program/errors[count(*)=0]
- //java/text()[contains(., 'new PhWith(ret, 0')]
- //java/text()[contains(., 'new PhWith(ret, "ρ"')]
- //java/text()[contains(., 'new PhWith(ret, "text"')]
eo: |
# This is the default 64+ symbols comment in front of named abstract object.
[] > main
stdout x:0 > print1
stdout x:^ > print2
stdout x:text > print3
stdout x:text > print2
2 changes: 1 addition & 1 deletion eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ version
;

// Binding
as : COLON (NAME | RHO | INT)
as : COLON (NAME | INT)
;

// Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ eo: |
z
f
12:foo
false:^
((t' r 8.54 "yes".< "\t").print 88 0x1f):hey
TRUE.<:vtx
false:fle > a!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
line: 2
eo: |
x
y:^
2 changes: 1 addition & 1 deletion eo-runtime/src/main/eo/org/eolang/bool.eo
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
# NOT.
[] > not
eq. > @
^
FALSE
^

# AND.
[x] > and
Expand Down
3 changes: 1 addition & 2 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOif.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ public EOif(final Phi sigma) {

@Override
public Phi lambda() {
final boolean term = new Param(this, "condition").strong(Boolean.class);
final Phi out;
if (term) {
if (new Param(this, "condition").strong(Boolean.class)) {
out = this.take("left");
} else {
out = this.take("right");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private static class AtMalloc implements Attr {

@Override
public Attr copy(final Phi self) {
return new AtMalloc(this.locator, this.length);
return new EOmemory$EOalloc.AtMalloc(this.locator, this.length);
}

@Override
Expand Down
1 change: 0 additions & 1 deletion eo-runtime/src/main/java/org/eolang/PhDefault.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package org.eolang;

import EOorg.EOeolang.EOerror;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down
104 changes: 29 additions & 75 deletions eo-runtime/src/test/eo/org/eolang/runtime-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
# Test.
# @todo #2931:30min Enable runtime tests. The tests were disabled because they stopped working
# when \rho attribute became immutable. Need to find out what's going on and enable them.
# Tests: parent-in-vertical-notation, parent-in-horizontal-notation, iterates-over-sigma,
# refers-to-inner-vars-correctly, recursion-without-arguments, right-way-to-use-hierarchy,
# calculates-only-once-BROKEN, directly-accesses-objects-from-standard-root,
# directly-accesses-objects-from-root, constant-defends-against-side-effects, makes-shallow-copy,
# calling-caged-function, standard-root-and-root, rho-of-add-should-not-change
# Tests: refers-to-inner-vars-correctly, makes-shallow-copy, calling-caged-function,
# rho-of-add-should-not-change
[] > understands-this-correctly
# Abstract a.
[x] > a
Expand Down Expand Up @@ -103,37 +100,21 @@
i.minus 1

# Test.
[] > iterates-over-sigma
memory 0 > x
eq. > res
seq
*
x.write TRUE
eq.
TRUE
x.as-bool.while
[i]
&.x.write FALSE > @
FALSE
nop > @

# Test.
[] > calculates-only-once-BROKEN
memory 0 > x
[] > calculates-only-once
memory.alloc 0 > x
# A.
[] > a
seq > @
*
x.write (x.as-int.plus 1)
42
eq. > res
eq. > @
seq
*
x.write 0
a.neg.neg.neg.neg.eq 42
x
1
nop > @

# Test.
[] > rho-of-add-should-not-change
Expand Down Expand Up @@ -186,7 +167,7 @@

# Test.
[] > recursion-without-arguments
memory 0 > n
memory.alloc 0 > n
# Func.
[] > func
if > @
Expand All @@ -195,15 +176,13 @@
*
n.write (n.as-int.minus 1)
^.func
TRUE
TRUE
eq. > res
n
eq. > @
seq
*
n.write 4
func
TRUE
nop > @
0

# Test.
[] > does-not-return-same-object
Expand Down Expand Up @@ -288,42 +267,39 @@

# Test.
[] > directly-accesses-objects-from-root
Q.org.eolang.memory 0 > m
eq. > res
seq
Q.org.eolang.memory.alloc 0 > m
eq. > @
seq > written!
*
m.write 42
Q.org.eolang.io.stdout
"Hello, world!"
m.write
m.as-int.minus 2
40
TRUE > @

# Test.
[] > directly-accesses-objects-from-standard-root
QQ.memory 0 > m
eq. > res
seq
QQ.memory.alloc 0 > m
eq. > @
seq > written!
*
m.write 42
QQ.io.stdout
"Works fine!"
m.write
m.as-int.minus 2
40
TRUE > @

# Test.
[] > standard-root-and-root
QQ.io.stdout > stand-root
QQ.io.stdout > stand-root!
"one"
Q.org.eolang.io.stdout > root
Q.org.eolang.io.stdout > root!
"one"
eq. > res
eq. > @
root
stand-root
TRUE > @

# Test.
[] > extract-attribute-from-decoratee
Expand Down Expand Up @@ -367,22 +343,21 @@

# Test.
[] > constant-defends-against-side-effects
memory 7 > a
memory.alloc 7 > a
# Increment.
[x] > inc
seq > @
*
x.write
x.as-int.plus 1
x.as-int
inc a > n!
int n > num
eq. > res
int > num
inc a > n!
eq. > @
times.
num
num
64
TRUE > @

# Test.
[] > makes-shallow-copy
Expand Down Expand Up @@ -415,31 +390,29 @@

# Test.
[] > parent-in-vertical-notation
memory 5 > m
memory.alloc 5 > m
# Value.
[] > value
# Phi.
[] > @
m. > @
^.
^
eq. > res
eq. > @
value
5
nop > @

# Test.
[] > parent-in-horizontal-notation
memory 5 > m
memory.alloc 5 > m
# Value.
[] > value
# Phi.
[] > @
^.^.m > @
eq. > res
eq. > @
value
5
nop > @

# Test.
[] > phi-in-vertical-notation
Expand All @@ -464,24 +437,6 @@
value.@
100

# Test.
[] > moves-copy-to-new-parent
eq. > @
# App.
[] > app
# App.phi.
[] > @
42 > x
foo > @
$:^
24:h
# Foo.
[h] > foo
plus. > @
h
^.x
66

# Test.
[] > right-way-to-use-hierarchy
# Bool mock
Expand All @@ -491,12 +446,11 @@
[value] > pyint
# Equal.
[x] > eq
pybool (value.eq x.value) > @
pybool (^.value.eq x.value) > @
# Add.
[x] > add
^.^.pyint (value.plus x.value) > @
((pyint 1).add (pyint 3)).eq (pyint 4) > res
TRUE > @
^.^.pyint (^.value.plus x.value) > @
((pyint 1).add (pyint 3)).eq (pyint 4) > @

# Test.
[] > check-triple-quotes
Expand Down
Loading

4 comments on commit 015b348

@0pdd
Copy link

@0pdd 0pdd commented on 015b348 Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2931-945d1fe5 disappeared from eo-runtime/src/test/java/EOorg/EOeolang/EOmemoryTest.java), that's why I closed #2977. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link

@0pdd 0pdd commented on 015b348 Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2931-21b6bf5f disappeared from eo-runtime/src/test/eo/org/eolang/runtime-tests.eo), that's why I closed #3007. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link

@0pdd 0pdd commented on 015b348 Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2931-4190276f disappeared from eo-runtime/src/test/eo/org/eolang/while-tests.eo), that's why I closed #3012. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link

@0pdd 0pdd commented on 015b348 Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2931-0ed69df1 discovered in eo-runtime/src/test/eo/org/eolang/runtime-tests.eo) and submitted as #3021. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.