Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1935fa5

Browse filesBrowse files
committed
More specific interface calling fix
1 parent cc1df05 commit 1935fa5
Copy full SHA for 1935fa5

File tree

Expand file treeCollapse file tree

2 files changed

+6
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-7
lines changed

‎compiler/expressions.go

Copy file name to clipboardExpand all lines: compiler/expressions.go
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,11 @@ func (c *funcContext) makeReceiver(e *ast.SelectorExpr) *expression {
812812

813813
_, isPointer := recvType.Underlying().(*types.Pointer)
814814
methodsRecvType := sel.Obj().Type().(*types.Signature).Recv().Type()
815+
816+
if _, isInterface := methodsRecvType.Underlying().(*types.Interface); isInterface {
817+
return c.formatExpr("$copyInterfaceVal(%e)", x)
818+
}
819+
815820
_, pointerExpected := methodsRecvType.(*types.Pointer)
816821
if !isPointer && pointerExpected {
817822
recvType = types.NewPointer(recvType)
@@ -825,6 +830,7 @@ func (c *funcContext) makeReceiver(e *ast.SelectorExpr) *expression {
825830
if isWrapped(recvType) {
826831
recv = c.formatExpr("new %s(%s)", c.typeName(methodsRecvType), recv)
827832
}
833+
828834
return recv
829835
}
830836

@@ -1112,12 +1118,6 @@ func (c *funcContext) translateImplicitConversion(expr ast.Expr, desiredType typ
11121118
}
11131119

11141120
exprType := c.p.TypeOf(expr)
1115-
1116-
// whenever expr has an underlying *types.Interface type we need to $copyInterfaceVal
1117-
if _, isIface := exprType.Underlying().(*types.Interface); isIface {
1118-
return c.formatExpr("$copyInterfaceVal(%e)", expr)
1119-
}
1120-
11211121
if types.Identical(exprType, desiredType) {
11221122
return c.translateExpr(expr)
11231123
}

‎tool.go

Copy file name to clipboardExpand all lines: tool.go
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,6 @@ func runNode(script string, args []string, dir string, quiet bool) error {
771771
}
772772
// rlimit value is in bytes, we need rounded kBytes value per node --v8-options.
773773
stackSize := fmt.Sprintf("--stack_size=%v", r.Cur/1000)
774-
775774
allArgs = append(allArgs, stackSize)
776775
}
777776

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.