Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Subclasses of String do not support alias and anchor #68

jrafanie opened this Issue · 2 comments

2 participants


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".

2) Error:
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:
Tested with psych master branch as of today and 1.9.3-p194.

How can I help fix this?


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


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).

@jrafanie jrafanie closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.