mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Correctly treat distinct inline types as having their inner type's methods available.
This commit is contained in:
@@ -3968,6 +3968,14 @@ CHECK_DEEPER:
|
||||
goto CHECK_DEEPER;
|
||||
}
|
||||
|
||||
if (type->type_kind == TYPE_DISTINCT && decl->is_substruct)
|
||||
{
|
||||
Expr *inner_expr = expr_copy(current_parent);
|
||||
type = type->decl->distinct_decl.base_type;
|
||||
inner_expr->type = type;
|
||||
current_parent = inner_expr;
|
||||
goto CHECK_DEEPER;
|
||||
}
|
||||
// 11b. Otherwise we give up.
|
||||
if (private)
|
||||
{
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.556"
|
||||
#define COMPILER_VERSION "0.4.557"
|
||||
32
test/test_suite/distinct/distinct_inline_access.c3
Normal file
32
test/test_suite/distinct/distinct_inline_access.c3
Normal file
@@ -0,0 +1,32 @@
|
||||
module testing;
|
||||
import std::io;
|
||||
import foo;
|
||||
|
||||
fn void main()
|
||||
{
|
||||
FooInt foo;
|
||||
}
|
||||
|
||||
def FooInt = distinct inline Foo;
|
||||
|
||||
struct Bar
|
||||
{
|
||||
FooInt list;
|
||||
}
|
||||
|
||||
fn void Bar.set(&self, int x)
|
||||
{
|
||||
self.list.set(x);
|
||||
}
|
||||
|
||||
module foo;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
int x;
|
||||
}
|
||||
|
||||
fn void Foo.set(&self, int x)
|
||||
{
|
||||
self.x = x;
|
||||
}
|
||||
Reference in New Issue
Block a user