title: Prevent a new block from being attached to the same type if the target is used as a StatementInput
body: <p>I basically have two types of blocks: a rule block and a fact block (just like in Prolog). They can both be attached to each other. The rule block expects two inputs of the type 'fact'. 
  However, it should not be possible to have multiple attached fact blocks as a single input. Therefore I had to set 'setNextStatement' to false whenever a fact block is attached as input of a rule block.</p>
  
  <p>This is what I tried to do in the fact block:</p>
  
  <pre><code>this.setOnChange(function(changeEvent) {
      if(changeEvent.type == Blockly.Events.MOVE) {
          let prevBlock = this.getPreviousBlock();
          if(prevBlock != null &amp;&amp; prevBlock.type == "rule") {
              let nextBlock = prevBlock.getNextBlock();
              if((nextBlock != null &amp;&amp; nextBlock != this) || (nextBlock == null)) {
  
                  this.setNextStatement(false);
              }
          } else {
              this.setNextStatement(true);
          }
      }
  });
  </code></pre>
  
  <p>And of course the rule block:</p>
  
  <pre><code>Blockly.Blocks['rule'] = {
      init: function() {
          this.appendDummyInput("RULE_DATA")
              .appendField('Rule: ');
  
          this.appendStatementInput('INPUT_HEAD')
              .setCheck("fact")
              .appendField("Head");
  
          this.appendStatementInput('INPUT_BODY')
              .setCheck("fact")
              .appendField("Body");
  ...
  
  </code></pre>
  
  <p>This actually works, but when I separate a fact from the input part of a rule, I always get the following error:</p>
  
  <pre><code>Uncaught Error: Connection lists did not match in length.
      at Blockly.BlockSvg.Blockly.Block.getMatchingConnection (blockly_compressed.js:1447)
      at Blockly.InsertionMarkerManager.connectMarker_ (blockly_compressed.js:1125)
      at Blockly.InsertionMarkerManager.showPreview_ (blockly_compressed.js:1118)
      at Blockly.InsertionMarkerManager.maybeShowPreview_ (blockly_compressed.js:1117)
      at Blockly.InsertionMarkerManager.update (blockly_compressed.js:1110)
      at Blockly.BlockDragger.dragBlock (blockly_compressed.js:1130)
      at Blockly.TouchGesture.Blockly.Gesture.startDraggingBlock_ (blockly_compressed.js:1177)
      at Blockly.TouchGesture.Blockly.Gesture.updateIsDraggingBlock_ (blockly_compressed.js:1174)
      at Blockly.TouchGesture.Blockly.Gesture.updateIsDragging_ (blockly_compressed.js:1176)
      at Blockly.TouchGesture.Blockly.Gesture.updateFromEvent_ (blockly_compressed.js:1171)
  </code></pre>
  
  <p>Does somebody has any idea?</p>