Subclasses of String do not support alias and anchor #68

Closed
jrafanie opened this Issue Jul 13, 2012 · 2 comments

Comments

2 participants
@jrafanie
Contributor

jrafanie commented Jul 13, 2012

An instance of a Subclass of String do not get anchored and aliased when referenced multiple times in an object, leading to different objects on Psych.load.

  1. Failure:
    test_anchor_alias_round_trip_substring_with_ivars(Psych::TestAliasAndAnchor) [/Users/joerafaniello/Code/github/psych/test/psych/test_alias_and_anchor.rb:111]:
    Expected "" (oid=70239656831080) to be the same as "" (oid=70239656831640).

Psych.load on an YAML containing an instance of a subclass of String anchored and aliased correctly from 1.8.7(Syck) raises "Unknown alias".

  1. Error:
    test_mri_compatibility_substring_with_ivars(Psych::TestAliasAndAnchor):
    Psych::BadAlias: Unknown alias: id001

Followup to #44 and somewhat related to #43

I have verified that a plain old ruby object and even a subclass of Array does alias and anchor properly.

See full failing tests here: https://gist.github.com/3106078
Tested with psych master branch as of today and 1.9.3-p194.

How can I help fix this?

@jrafanie

This comment has been minimized.

Show comment Hide comment
@jrafanie

jrafanie Jul 13, 2012

Contributor

Not sure if this should be broken up into two issues, let me know if that is desired.

Contributor

jrafanie commented Jul 13, 2012

Not sure if this should be broken up into two issues, let me know if that is desired.

@tenderlove

This comment has been minimized.

Show comment Hide comment
@tenderlove

tenderlove Jul 13, 2012

Member

Sure! I can fix this, or if you'd like I'd be happy to walk you through solving the problem. We can meet on IRC, or I'll just comment here (it's up to you).

Member

tenderlove commented Jul 13, 2012

Sure! I can fix this, or if you'd like I'd be happy to walk you through solving the problem. We can meet on IRC, or I'll just comment here (it's up to you).

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