From ea3c657845313a274f99cc568ff4e3310e248e15 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 23 Oct 2016 19:38:13 +0800 Subject: AST+HIR - Add stubbed support for erased types (`impl Trait`) --- src/ast/types.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ast/types.cpp') diff --git a/src/ast/types.cpp b/src/ast/types.cpp index 1c6cc568..7468dcf7 100644 --- a/src/ast/types.cpp +++ b/src/ast/types.cpp @@ -118,6 +118,7 @@ TypeRef::TypeRef(const TypeRef& other) _COPY(Generic) _COPY(Path) _COPY(TraitObject) + _COPY(ErasedType) #undef _COPY #undef _CLONE } @@ -171,6 +172,9 @@ Ordering TypeRef::ord(const TypeRef& x) const return ent.path.ord( x_ent.path ); ), (TraitObject, + return ::ord(ent.traits, x_ent.traits); + ), + (ErasedType, return ::ord(ent.traits, x_ent.traits); ) ) @@ -249,6 +253,15 @@ Ordering TypeRef::ord(const TypeRef& x) const } os << ")"; ) + _(ErasedType, + os << "impl "; + for( const auto& it : ent.traits ) { + if( &it != &ent.traits.front() ) + os << "+"; + os << it; + } + os << ""; + ) } #undef _ //os << ")"; -- cgit v1.2.3