Commit Graph
7 Commits
Author SHA1 Message Date
Jon Ross-Perkins 357baaeef8 Rename //explorer/common to base (#3103)
Renaming per #3100
2023-08-15 19:23:23 +00:00
Richard Smith e066e96464 Fix false positive in potential cycle detection. (#2879)
Fix misidentification of a potential cycle in the case where the inner match is missing labels from the outer match, and the inner match is strictly more complex when considering only its labels. We previously ignored labels in the outer match that are absent in the inner match, but the existence of any such label should cause us to treat the inner match as not being strictly more complex.
2023-06-07 14:39:05 -07:00
josh11bandGeoff Romer 46503c0a9d Explorer and toolchain changes to implement #2483 (#2707)
This PR is making two main changes to the Explorer and Toolchain:
- Replace the `is` keyword in `where SomeType is SomeInterface` with `impls`, so it is `where SomeType impls SomeInterface`
- Rewrite uses of the "impls" to something else to avoid, frequently "`impl` declarations" or "implementations", to avoid confusion with the `impls` keyword.

---------

Co-authored-by: Geoff Romer <gromer@google.com>
2023-03-28 12:28:52 -07:00
Richard Smith bfe5c36bfc Move Value, Address, and ElementPath to ast/. (#2659)
These are used by the AST in lots of ways, and this resolves various layering issues.

This means that `AllocationId` also lives in ast/, but is managed by interpreter/. A better layering here would be desirable, but this seems good enough for the time being.
2023-03-06 16:28:03 -08:00
Jon Ross-PerkinsandRichard Smith 7fe8bb308b Clean up clang-tidy issues in explorer. (#2621)
google-readability-function-size and readability-function-size were _both_ triggering on TypeCheckExp. It looks like the Google version may be a subset of the general version, so I've disabled the Google version while keeping the general version and adding a NOLINT for it.

I manually removed the `const` in cases like `Nonnull<const VTable* const>` based on the readability-const-return-type warning. i.e., where a return type is a pointer, the `const` isn't meaningful and the tidy check was warning about that.

Added a NOLINT for misc-definitions-in-headers on IsRecursivelyTransformable. I think that's the right choice for the `constexpr`, the warning didn't feel accurate and may be getting confused by the templating.

I changed the structure of `carbon_files` in the fuzzer because the `new` was causing a warning about exceptions. However, also disabling bugprone-exception-escape because it's what was flagging this and it's not really a helpful warning.

Other changes were automated.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-03-01 13:12:51 -08:00
Richard Smith 81532c8918 Fix mishandling of struct and tuple types in impl matching termination check. (#2609)
Both cases need a label for each level of struct and tuple type appearing in the impl query, because we can have an unbounded number of such levels with the types otherwise being the same.

Prior to this, both added testcases exhibit unbounded recursion.
2023-02-15 15:10:01 -08:00
Richard Smith 0e41c569b1 Implement the termination algorithm for impl selection described in #2458 (#2602)
Detect when evaluating an impl recursively tries to evaluate the same impl for the same or a more complex set of parameters.

In order to perform the check after we have tested that the type structure matches and before we check that constraints are recursively satisfied, argument deduction is extended to check structural matching properties earlier.

This requires us to separate match failures into two kinds: hard failures that produce errors that should never be swallowed, and soft failures such as a missing impl that lead us to merely discard an impl as a candidate. A flag has been added to `ImplScope` and `ArgumentDeduction` to specify whether soft failures should produce an error message or not.
2023-02-14 17:44:16 -08:00