Skip to content

Commit

Permalink
[FIXED]#630 - Nil reference cannot be assigned to struct
Browse files Browse the repository at this point in the history
  • Loading branch information
arakov committed Nov 5, 2023
1 parent 6fccfa4 commit f466047
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions doc/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ In development:
port:gui samples, db samples, xforms, elenavm / elt for linux
--------------------------------------

* default - if reference type - returns nil, if struct - compiles the default constructor call


* #630 : Nil reference cannot be assigned to struct

* comparing Symbols
Expand Down
4 changes: 4 additions & 0 deletions elenasrc3/elc/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7964,6 +7964,10 @@ bool Compiler :: compileAssigningOp(WriterContext& context, ObjectInfo target, O
context.writer->newNode(operationType, operand);
if (size != 0) {
context.writer->appendNode(BuildKey::Size, size);

// HOTFIX : nil cannit be assigned to a struct
if (exprVal.kind == ObjectKind::Nil)
context.scope->raiseError(errInvalidOperation, context.node);
}
context.writer->closeNode();

Expand Down
2 changes: 1 addition & 1 deletion tests60/sandbox/sandbox.l
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public sealed const struct XSymbol
}

static XSymbol Default
= default/*nil*/;
= default;
}

public program()
Expand Down

0 comments on commit f466047

Please sign in to comment.