diff options
-rw-r--r-- | src/hir/type.hpp | 4 | ||||
-rw-r--r-- | src/hir_typeck/expr.cpp | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/hir/type.hpp b/src/hir/type.hpp index adb48df0..597319a9 100644 --- a/src/hir/type.hpp +++ b/src/hir/type.hpp @@ -73,8 +73,8 @@ public: // - Pointer TAGGED_UNION(TypePathBinding, Unbound, - (Unbound, struct {}), // Not yet bound (state during first part of lowering) - TODO kill - (Opaque, struct {}), + (Unbound, struct {}), // Not yet bound, either during lowering OR during resolution (when associated and still being resolved) + (Opaque, struct {}), // Opaque, i.e. An associated type of a generic (or Self in a trait) (Struct, const ::HIR::Struct*), (Enum, const ::HIR::Enum*) ); diff --git a/src/hir_typeck/expr.cpp b/src/hir_typeck/expr.cpp index c952de4f..9bb1bcac 100644 --- a/src/hir_typeck/expr.cpp +++ b/src/hir_typeck/expr.cpp @@ -1193,6 +1193,7 @@ namespace { ), (UfcsKnown, DEBUG("Locating associated type for " << e.path); + // TODO: Use the marker `e.binding` to tell if it's worth trying *e2.type = expand_associated_types(sp, mv$(*e2.type)); @@ -1223,6 +1224,14 @@ namespace { return input; } + // Use bounds on other associated types too (if `e2.type` was resolved to a fixed associated type) + TU_IFLET(::HIR::TypeRef::Data, e2.type->m_data, Path, e3, + TU_IFLET(::HIR::Path::Data, e3.path.m_data, UfcsKnown, pe, + // TODO: Search for equality bounds on this associated type (e3) that match the entire type (e2) + // - Does simplification of complex associated types + ) + ) + // 2. Crate-level impls rv = this->m_crate.find_trait_impls(e2.trait.m_path, *e2.type, cb_get_infer, [&](const auto& impl) { |