Nested select operation require instantiation of local variable

Hi, I have the following construct:

list<list<[enummember<MyEnum>, node<MyConcept>]>> result = 
this.someCollection
.select({\itemOuter => itemOuter.subCollection
.select({\itemInner => [this.mapIndexToMyEnum[itemInner.index], itemInner.someLookupOfMyConceptInstance()];
}).toList;
}).toList;


This does not compile, with the following error message:
`: Type mismatch: cannot convert from IListSequence<IListSequence<Tuples._2<SEnumerationLiteral,SNode>>> to List<List<Tuples._2<SEnumerationLiteral,SNode>>> (line: 90)`

However, when I introduce a local variable for the result of the inner `select` operation, like so (basically hitting Ctrl+Alt+V at the inner "toList" operation), it does compile:

 

list<list<[enummember<MyEnum>, node<MyConcept>]>> listOuterResult = 
this.someCollection
.select({\itemOuter => list<[enummember<MyEnum>, node<MyConcept>]> listInnerResult = itemOuter.subCollection
.select({\itemInner => [this.mapIndexToMyEnum[itemInner.index], itemInner.someLookupOfMyConceptInstance()];
}).toList;
return listInnerResult;
}).toList;

This is really annoying since it makes the code less readable by quite a bit. Any idea if this is a bug?

Please sign in to leave a comment.