diff --git a/examples/test/misc/hello_world.das b/examples/test/misc/hello_world.das index 101cb7d84..f6f531f2b 100644 --- a/examples/test/misc/hello_world.das +++ b/examples/test/misc/hello_world.das @@ -189,11 +189,13 @@ tuple Tup { [export] def test_tuples { - let a : tuple = (1,2.,"3"); - let b : tuple = tuple(1,2.,"3"); - let c : tuple = tuple(a=1,b=2.,c="3"); - let e : tuple = tuple(uninitialized a=1); // a=1,b=0.0,c="" - let f : tuple* = new tuple(1,2.,"3"); // on heap + let a : tuple = (1,2.,"3"); debug(a); + let b : tuple = tuple(1,2.,"3"); debug(b); + let c : tuple = Tup(1,2.,"3"); debug(c); + let d : tuple = Tup(a=1,b=2.,c="3"); debug(d); + let e : tuple = tuple(a=1,b=2.,c="3"); debug(e); + let f : tuple = tuple(uninitialized a=1); debug(f); // a=1,b=0.0,c="" + let g : tuple* = new tuple(1,2.,"3"); debug(g); // on heap } /////////// diff --git a/src/ast/ast_infer_type.cpp b/src/ast/ast_infer_type.cpp index da48fd018..4c7046e41 100644 --- a/src/ast/ast_infer_type.cpp +++ b/src/ast/ast_infer_type.cpp @@ -8154,8 +8154,21 @@ namespace das { ecast->reinterpret = true; ecast->alwaysSafe = true; expr->aliasSubstitution.reset(); + reportAstChanged(); return ecast; } + if ( !expr->func ) { + auto aliasT = findAlias(expr->name); + if ( aliasT && aliasT->isTuple() ) { + auto mkt = make_smart(expr->at); + mkt->type = make_smart(*aliasT); + for ( auto & arg : expr->arguments ) { + mkt->values.push_back(arg->clone()); + } + reportAstChanged(); + return mkt; + } + } if ( func && !expr->func && func->isClassMethod && func->arguments.size()>=1 ) { auto bt = func->arguments[0]->type; if ( bt && bt->isClass() ) {