Skip to content

Commit a5ab8ea

Browse files
committed
#167 - fix
1 parent ae09dfc commit a5ab8ea

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Application/HydraScript.Application.StaticAnalysis/Impl/DefaultValueForTypeCalculator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ internal class DefaultValueForTypeCalculator : IDefaultValueForTypeCalculator
1212

1313
public object? GetDefaultValueForType(Type type)
1414
{
15+
if (type is NullableType)
16+
return null;
1517
if (type.Equals(_boolean))
1618
return false;
1719
if (type.Equals(_number))

src/Application/HydraScript.Application.StaticAnalysis/Visitors/SemanticChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ public Type Visit(FunctionDeclaration visitable)
475475
else
476476
{
477477
var wrongReturn = returnStatements
478-
.FirstOrDefault(x => !x.Type.Equals(symbol.Type));
478+
.FirstOrDefault(x => !symbol.Type.Equals(x.Type));
479479
if (wrongReturn is not null)
480480
throw new WrongReturnType(
481481
wrongReturn.Statement.Segment,

0 commit comments

Comments
 (0)