New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloaded `=` not called for nested objects #6347

Closed
yglukhov opened this Issue Sep 8, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@yglukhov
Copy link
Member

yglukhov commented Sep 8, 2017

type
    Foo = object
        a: int
    Bar = object
        f: Foo

proc `=`(a: var Foo, b: Foo) =
    system.`=`(a, b)
    echo "="

var a, b: Bar
a = b

Expected output:

=

Actual output: none

@Araq Araq added the Destructors label Oct 15, 2018

@cooldome

This comment has been minimized.

Copy link
Member

cooldome commented Jan 9, 2019

the following works, it is ordering issue plus it is sink instead of assign:

type
  Foo = object
      a: int

proc `=sink`(a: var Foo, b: Foo) =
  system.`=`(a, b)
  echo "="

type
  Bar = object
      f: Foo

var a, b: Bar
a = b

output:

=

@Araq Araq closed this Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment