Archived

This forum has been archived. Please start a new discussion on GitHub.

ICE 3.0.0 CS code generation issue

Hi ZeroC,

first of all gratulations to ICE 3.0.0!
I specially like the the CS enhandments! Thanks alot!

But I'm sorry to report a bug in the new CS code generation.

Please find the sample project attached.
module A
{
	class S
	{
		int	a;
	};
	["clr:collection"]
	sequence<S>					SSeq;
	dictionary<string, SSeq>	StringSSeqDict;
};

generates this code:
	public static StringSSeqDict read(IceInternal.BasicStream is__)
	{
	    int sz__ = is__.readSize();
	    StringSSeqDict r__ = new StringSSeqDict();
	    for(int i__ = 0; i__ < sz__; ++i__)
	    {
		string k__;
		k__ = is__.readString();
		A.SSeq v__;
		{
		    int szx__ = is__.readSize();
		    is__.startSeq(szx__, 4);
		    v__ = new A.SSeq(szx__);
		    for(int i__ = 0; i__ < szx__; ++i__)
		    {
			IceInternal.SequencePatcher spx = new IceInternal.SequencePatcher(v__, typeof(A.S), i__);
			is__.readObject(spx);
			is__.checkSeq();
			is__.endElement();
		    }
		    is__.endSeq(szx__);
		}
		r__[k__] = v__;
	    }
	    return r__;
	}

the CS compiler doesn't like the reuse of "i__".

in ICE-2.1.2 the second for loop was working with "i".

Greeting and take care

Tom

Comments

  • DeepDiver wrote:
    But I'm sorry to report a bug in the new CS code generation.

    Please find the sample project attached.

    [...]

    the CS compiler doesn't like the reuse of "i__".

    Aarghhh... :( Personally, I think the compiler should go and jump in a lake. What's the point of having nested scopes when I can't use them to protect myself from name clashes? :(

    Thanks for pointing this out, I'll post a fix ASAP.

    Cheers,

    Michi.
  • I've posted a patch for this problem. Thanks for reporting this!

    Cheers,

    Michi.