Initial support for generic parameters that are introduced in a function parameter list (#1247)

In order for this to work, we need to always use the argument deduction code path for function calls, instead of only using it when there is a `[...]` list, which means that argument deduction now needs to support implicit conversion.

Co-authored-by: Jon Meow <jperkins@google.com>
This commit is contained in:
Richard Smith
2022-05-12 08:48:19 -07:00
committed by GitHub
co-authored by Jon Meow
parent b27aa21a88
commit c29f56e667
14 changed files with 320 additions and 177 deletions
+7 -5
View File
@@ -17,6 +17,7 @@
#include "explorer/ast/value_category.h"
#include "explorer/common/source_location.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLFunctionalExtras.h"
namespace Carbon {
@@ -88,11 +89,12 @@ class Pattern : public AstNode {
std::optional<Nonnull<const Value*>> value_;
};
class BindingPattern;
// Returns all `BindingPattern`s in the AST subtree rooted at `pattern`.
auto GetBindings(const Pattern& pattern)
-> std::vector<Nonnull<const BindingPattern*>>;
// Call the given `visitor` on all patterns nested within the given pattern,
// including `pattern` itself. Aborts and returns `false` if `visitor` returns
// `false`, otherwise returns `true`.
auto VisitNestedPatterns(const Pattern& pattern,
llvm::function_ref<bool(const Pattern&)> visitor)
-> bool;
// A pattern consisting of the `auto` keyword.
class AutoPattern : public Pattern {