Fix printing function types like (a -> b) -> c
This commit is contained in:
parent
7d5795d9bf
commit
357baa9652
3 changed files with 6 additions and 2 deletions
|
|
@ -52,7 +52,7 @@ namespace pslang::ast
|
||||||
|
|
||||||
void apply(function_type const & type)
|
void apply(function_type const & type)
|
||||||
{
|
{
|
||||||
if (type.arguments.size() == 1)
|
if (type.arguments.size() == 1 && !std::get_if<function_type>(type.arguments[0].get()))
|
||||||
{
|
{
|
||||||
apply(*type.arguments.front());
|
apply(*type.arguments.front());
|
||||||
out << " -> ";
|
out << " -> ";
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ namespace pslang::types
|
||||||
|
|
||||||
void apply(function_type const & type)
|
void apply(function_type const & type)
|
||||||
{
|
{
|
||||||
if (type.arguments.size() == 1)
|
if (type.arguments.size() == 1 && !is_function_type(*type.arguments[0]))
|
||||||
{
|
{
|
||||||
apply(*type.arguments.front());
|
apply(*type.arguments.front());
|
||||||
out << " -> ";
|
out << " -> ";
|
||||||
|
|
|
||||||
|
|
@ -40,3 +40,7 @@ General backlog:
|
||||||
* Mutually recursive structs (relevant only with pointers)
|
* Mutually recursive structs (relevant only with pointers)
|
||||||
* Empty array expression
|
* Empty array expression
|
||||||
* Calling functions as methods
|
* Calling functions as methods
|
||||||
|
* Replace std::runtime_error with appropriate custom exception types
|
||||||
|
* Replace std::ostringstream with std::format
|
||||||
|
* TEST COVERAGE!!!
|
||||||
|
* Separate actual AST from pre-AST (the one before indentation & scoping is resolved)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue