Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pnc/src/Binder.pn
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,12 @@ class Binder(
options match {
case FieldOptions.TypeAndExpression(fieldType, expression) =>
// TODO: this expression needs to be added to the symbol's constructor body
val expr = exprBinder.bindConversionExpr(expression, fieldType, scope)
val expr = exprBinder.check(expression, fieldType, scope)
setSymbolType(symbol, fieldType)
case FieldOptions.TypeOnly(fieldType) =>
setSymbolType(symbol, fieldType)
case FieldOptions.ExpressionOnly(expression) =>
val expr = exprBinder.bind(expression, scope)
val expr = exprBinder.infer(expression, scope)
// TODO: this expression needs to be added to the symbol's constructor body
val returnType = getType(expr)
setSymbolType(symbol, returnType)
Expand All @@ -657,9 +657,9 @@ class Binder(
case Option.Some(expression) =>

val boundExpr = returnType match {
case Option.None => exprBinder.bind(expression, methodScope)
case Option.None => exprBinder.infer(expression, methodScope)
case Option.Some(toType) =>
exprBinder.bindConversionExpr(expression, toType, methodScope)
exprBinder.check(expression, toType, methodScope)
}

functionBodies = functionBodies.put(symbol, boundExpr)
Expand Down
Loading