Skip to content

Commit

Permalink
Additional fixes and improvements of smartmatch optimizations
Browse files Browse the repository at this point in the history
- Better detection of invocations, method calls wrapped into `hllize`
  are considered now.
- Better detection of possible return value type for an AST node.
- As a result of the above two items, smartmatches with method calls can
  now be optimized too.
- For some instantiations we can now infer the final type of returned
  object. In some cases it may differ from the invocator's type if
  method `new` decides it would make sense to return something
  different. For example, iterators often return an `Empty` iterator if
  there are no elements in an iterable object.
- On some occasions when smartmatch topic/LHS hapens to be a `Junction`
  at run-time, instead of falling back to `.ACCEPTS.Bool` on RHS to
  handle the junction correctly, it is possible to use a new `Junction`
  method `BOOLIFY-ACCEPTS` with topic/LHS as method's invocant. The
  method avoids extra iterations over eigenstates when possible; i.e. it
  shortcuts when conditions allow.
- Fixed typematching sometimes not respecting junctions.
- Tydied up `Regexp` safety check.

Fixes #4693
  • Loading branch information
vrurg committed Jan 4, 2022
1 parent d80fb89 commit 2a3f61e
Show file tree
Hide file tree
Showing 2 changed files with 314 additions and 113 deletions.

0 comments on commit 2a3f61e

Please sign in to comment.