Kirill Simonov avatar Kirill Simonov committed 8526ec1

Added a test case breaking `fork()`.

Comments (0)

Files changed (2)

src/htsql/util.py

         # is assumed.  Note that `A is B` <=> `id(A) == id(B)`.
         if equality_vector is None:
             equality_vector = id(self)
+        # Flatten the vector.
+        if isinstance(equality_vector, tuple):
+            elements = []
+            for element in equality_vector:
+                if isinstance(element, Comparable):
+                    elements.append((element.__class__, element.hash,
+                                     element.equality_vector))
+                else:
+                    elements.append(element)
+            equality_vector = tuple(elements)
         self.equality_vector = equality_vector
         self.hash = hash(equality_vector)
 

test/regress/input/translation.yaml

     - uri: /(program^degree)?count(^.student)=max(fork().count(^.student))
     # fork() with nullable kernel
     - uri: /program.fork(part_of){root().program{school.code, code, part_of}, school.code, code, part_of}
+    # fork().fork() is inefficient
+    - uri: /school.fork().fork().fork()
+      skip: true
 
   - title: Table Expressions
     tests:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.