Skip to content
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

Copying class using class browser 'entangles' class variables #8044

Closed
jvalteren opened this issue Dec 10, 2020 · 0 comments · Fixed by #8045
Closed

Copying class using class browser 'entangles' class variables #8044

jvalteren opened this issue Dec 10, 2020 · 0 comments · Fixed by #8045

Comments

@jvalteren
Copy link

Describe the bug
When copying a class using the context menu 'Copy' command in the class browser, the class variables in the new class are 'entangled' with the old class. In other words, when the value of the class variable in the old class is changed, the value of the class variable in the new (copied) class also changes and vice versa.

To Reproduce
Steps to reproduce the behavior:

  1. Open a class browser on the DateAndTime class.
  2. Right-click on the class and select 'Copy'. Fill in a name for the copy, e.g. 'DateAndTimeCopy'.
  3. Open a new playground window:
    a. Type DateAndTime localTimeZone. and print it. If you're in time zone CET like me, this will print a LocalTimeZone(LT1:00).
    b. Type DateAndTimeCopy localTimeZone. and print it. This will print the same value.
    c. Type DateAndTime localTimeZone: (TimeZone offset: -8 hours). and do it.
    d. Performs step 3b again. It should print a LocalTimeZone(LT1:00), but instead it prints a TimeZone(PST).

Expected behavior
Above, in step 3d, it should have printed a LocalTimeZone(LT1:00) since we didn't change the value of the local time zone class variable in the DateAndTimeCopy.

Screenshots
Class browser context menu 'Copy' command
(Screenshot 1 - Class browser context menu 'Copy' command)

Screenshot 2020-12-10 at 12 23 54
(Screenshot 2 - Example results showing bug)

Version information:

  • OS: macOS Mojave 10.14.6 (18G6042)
  • Affected versions: Pharo9.0.0 (build: 950, commit: 9a9de50) and Pharo8.0.0 (build: 1124, commit: 0932da8)

Expected development cost
Zero. I will provide a fix.

Additional context
Pharo version 7.0 does not have this issue.

jvalteren pushed a commit to objectguild/pharo that referenced this issue Dec 10, 2020
Based on Pharo 7.0 implementation which doesn't have this issue.
@MarcusDenker MarcusDenker linked a pull request Dec 14, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant