From ab7df1d155b46da13d7734737315a187c50e1734 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 1 Oct 2017 11:11:52 +0800 Subject: Resolve - Search for unit-like structs in pattern lookup --- src/resolve/absolute.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp index 8b5732a8..ef635ef0 100644 --- a/src/resolve/absolute.cpp +++ b/src/resolve/absolute.cpp @@ -339,6 +339,18 @@ namespace case ::AST::PathBinding::TAG_Static: path = ::AST::Path( v->second.path ); return true; + case ::AST::PathBinding::TAG_Struct: + // TODO: Restrict this to unit-like structs + if( b.as_Struct().struct_ && !b.as_Struct().struct_->m_data.is_Unit() ) + ; + else if( b.as_Struct().hir && !b.as_Struct().hir->m_data.is_Unit() ) + ; + else + { + path = ::AST::Path( v->second.path ); + return true; + } + break; default: break; } -- cgit v1.2.3