@@ -657,8 +657,10 @@ public Object invoke(Object reader, Object caret) throws Exception{
657657 if (r instanceof LineNumberingPushbackReader )
658658 line = ((LineNumberingPushbackReader ) r ).getLineNumber ();
659659 Object meta = read (r , true , null , true );
660- if (meta instanceof Symbol || meta instanceof Keyword || meta instanceof String )
660+ if (meta instanceof Symbol || meta instanceof String )
661661 meta = RT .map (RT .TAG_KEY , meta );
662+ else if (meta instanceof Keyword )
663+ meta = RT .map (meta , true );
662664 else if (!(meta instanceof IPersistentMap ))
663665 throw new IllegalArgumentException ("Metadata must be Symbol,Keyword,String or Map" );
664666
@@ -672,7 +674,12 @@ else if(!(meta instanceof IPersistentMap))
672674 ((IReference )o ).resetMeta ((IPersistentMap ) meta );
673675 return o ;
674676 }
675- return ((IObj ) o ).withMeta ((IPersistentMap ) meta );
677+ Object ometa = RT .meta (o );
678+ for (ISeq s = RT .seq (meta ); s != null ; s = s .next ()) {
679+ IMapEntry kv = (IMapEntry ) s .first ();
680+ ometa = RT .assoc (ometa , kv .getKey (), kv .getValue ());
681+ }
682+ return ((IObj ) o ).withMeta ((IPersistentMap ) ometa );
676683 }
677684 else
678685 throw new IllegalArgumentException ("Metadata can only be applied to IMetas" );
0 commit comments