title: Rascal erases type information when appending a list to a list of lists
body: <p>I have the following function:</p>
  
  <pre><code>public list[list[loc]] populateBeforeRemoval(){
      list[list[loc]] dupList = [];
      map[int, list[loc]] finalizedDups = ();
  
      // Here some stuff is added to the finalizedDups map, however, I have omitted it for simplicity.
  
      for(dup &lt;- finalizedDups){
          dupList+=finalizedDups[dup];
      }
      return dupList;
  }
  </code></pre>
  
  <p>However, when I run this function, I get the following output:</p>
  
  <pre><code>|project://TestProject/src/astCreation.rsc|(4955,3,&lt;142,40&gt;,&lt;142,43&gt;): Expected list[list[loc]], but got list[value]
  Advice: |http://tutor.rascal-mpl.org/Errors/Static/UnexpectedType/UnexpectedType.html|
  </code></pre>
  
  <p>When I click on the message, it points to the return value (<code>dupList</code>) in the code. It seems that the addition of <code>finalizedDups[dup]</code> erases the type (<code>list[loc]</code>) of the list. This should not be possible right?</p>
  
  <p>Just for the sake of completeness, here is the entire (actual) function:</p>
  
  <pre><code>public list[list[loc]] populateBeforeRemoval(list[list[loc]] dupList, list[loc] potentialDuplicates, list[loc] newPotentialDuplicates, loc location, int lineNumber){
      map[int, list[loc]] finalizedDups = ();
      for(dup &lt;- potentialDuplicates, getSourceLength(dup)&gt;=6){
          bool sameIn = false;
          for(pot &lt;- newPotentialDuplicates){
              if(pot.uri == dup.uri &amp;&amp; pot.begin.line == dup.begin.line){
                  sameIn = true;
              }
          }
          if(!sameIn){
              int srcLength = getSourceLength(dup);
              if(srcLength in finalizedDups){
                  finalizedDups[srcLength]+=dup;
              } else {
                  location.end.line = lineNumber-1;
                  location.begin.line = lineNumber-srcLength-1;
                  finalizedDups[srcLength]=[location, dup];
              }
          }
      }
      for(dup &lt;- finalizedDups){
          dupList+=finalizedDups[dup];
      }
      return dupList;
  }
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>In the beginning this code showed a lot of errors in the eclipse IDE. After renaming <code>dup</code> to something else most of these errors disappeared. It's probably because <code>dup</code> is a function in the <code>List.rsc</code> (<a href="http://tutor.rascal-mpl.org/Rascal/Libraries/Prelude/List/dup/dup.html" rel="nofollow noreferrer">http://tutor.rascal-mpl.org/Rascal/Libraries/Prelude/List/dup/dup.html</a>) which I imported. Seems to be an issue with the Eclipse plugin, the lines that were shown as error are do not create an error in runtime.</p>
  
  <p>The main issue is however not solved. I think this issue is due to appending a list to a list of lists. </p>