mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Implement ...where .Self impls... (#5238)
* Also remove facet type deduction, since we decided against it on [2025-04-02](https://docs.google.com/document/d/1Iut5f2TQBrtBNIduF4vJYOKfw7MbS8xH_J01_Q4e6Rk/edit?pli=1&resourcekey=0-mc_vh5UzrzXfU4kO-3tOjA&tab=t.0#heading=h.95phmuvxog9n). --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com> Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
co-authored by
Josh L
Dana Jansens
parent
87f0e9723f
commit
4af0c8f8d1
@@ -1245,10 +1245,10 @@ class FormatterImpl {
|
||||
out_ << "<";
|
||||
|
||||
llvm::ListSeparator sep(" & ");
|
||||
if (info.impls_constraints.empty()) {
|
||||
if (info.extend_constraints.empty()) {
|
||||
out_ << "type";
|
||||
} else {
|
||||
for (auto interface : info.impls_constraints) {
|
||||
for (auto interface : info.extend_constraints) {
|
||||
out_ << sep;
|
||||
FormatName(interface.interface_id);
|
||||
if (interface.specific_id.has_value()) {
|
||||
@@ -1258,10 +1258,22 @@ class FormatterImpl {
|
||||
}
|
||||
}
|
||||
|
||||
if (info.other_requirements || !info.rewrite_constraints.empty()) {
|
||||
// TODO: Include specifics.
|
||||
if (info.other_requirements || !info.self_impls_constraints.empty() ||
|
||||
!info.rewrite_constraints.empty()) {
|
||||
out_ << " where ";
|
||||
llvm::ListSeparator and_sep(" and ");
|
||||
if (!info.self_impls_constraints.empty()) {
|
||||
out_ << and_sep << ".Self impls ";
|
||||
llvm::ListSeparator amp_sep(" & ");
|
||||
for (auto interface : info.self_impls_constraints) {
|
||||
out_ << amp_sep;
|
||||
FormatName(interface.interface_id);
|
||||
if (interface.specific_id.has_value()) {
|
||||
out_ << ", ";
|
||||
FormatName(interface.specific_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto rewrite : info.rewrite_constraints) {
|
||||
out_ << and_sep;
|
||||
FormatConstant(rewrite.lhs_const_id);
|
||||
|
||||
Reference in New Issue
Block a user