google / codeworld

Educational computer programming environment using Haskell
http://code.world
Apache License 2.0
1.24k stars 197 forks source link

Glitch in blocks #410

Open cdsmith opened 7 years ago

cdsmith commented 7 years ago

https://code.world/blocks#PCtcQTilUOQ4QTHrcE4fxbg

Try to add a new picture to the list, and things go completely bonkers. The blockly XML is:

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="cwAnimationOf" id="c#-N~V-_c-/dkSP9(nr4" x="111" y="71">
    <value name="FUNC">
      <block type="procedures_callreturn" id="@FHEycH[MwY7g4y88C@9">
        <mutation name="winter">
          <arg name="t" />
        </mutation>
      </block>
    </value>
  </block>
  <block type="procedures_letFunc" id="M%]bzRjQgOc)AS1P-j0l" x="115" y="235">
    <mutation>
      <arg name="x" />
    </mutation>
    <field name="NAME">snowman</field>
    <value name="RETURN">
      <block type="cwCombine" id="_Ig2SrGyzw_+F:L/|ZqS">
        <mutation items="4" />
        <value name="PIC0">
          <block type="cwTranslate" id="a!HpxRNh`eq^lha4@{=u">
            <value name="PICTURE">
              <shadow type="cwBlank" id="*~t=.!}!O;hL/K!/_6{W" />
              <block type="cwColored" id="T/tp]PP.kLzACf:A}c,I">
                <value name="PICTURE">
                  <shadow type="cwBlank" id="NyklagrM-WCC(Bj36L9R" />
                  <block type="cwThickArc" id="S%P*]Nw~Ni?{/A[Eh!*F">
                    <value name="STARTANGLE">
                      <shadow type="numNumber" id="d{o{w783Q*K62NiL7.q0">
                        <field name="NUMBER">-7</field>
                      </shadow>
                    </value>
                    <value name="ENDANGLE">
                      <shadow type="numNumber" id="/9tA5xoyxyZ9hGL4x+qV">
                        <field name="NUMBER">7</field>
                      </shadow>
                    </value>
                    <value name="RADIUS">
                      <shadow type="numNumber" id="|H*qX^*L5rm.(x0KFLsM">
                        <field name="NUMBER">1</field>
                      </shadow>
                    </value>
                    <value name="LINEWIDTH">
                      <shadow type="numNumber" id="=ezR[Yh,FQ?Fu6eR2~]4">
                        <field name="NUMBER">2</field>
                      </shadow>
                    </value>
                  </block>
                </value>
                <value name="COLOR">
                  <shadow type="cwBlack" id="HN:saTBNQQ@Q+W4q_)8{" />
                  <block type="cwOrange" id="M{7is]h,tf#I)N!(8Qt6" />
                </value>
              </block>
            </value>
            <value name="X">
              <shadow type="numNumber" id="l5|@7z00glPv;A#7u!{k">
                <field name="NUMBER">-3</field>
              </shadow>
            </value>
            <value name="Y">
              <shadow type="numNumber" id="Usp4Lgy=hDOh1]SuTeAs">
                <field name="NUMBER">5</field>
              </shadow>
            </value>
          </block>
        </value>
        <value name="PIC1">
          <block type="cwTranslate" id="wOB~/)V_@51g2NCdFAs.">
            <value name="PICTURE">
              <shadow type="cwBlank" id="98@ZeIu]!11`X@MHz5+N" />
              <block type="cwColored" id="HMW,5^OY?xTJL|FQ=-r6">
                <value name="PICTURE">
                  <shadow type="cwBlank" id="INutu}Pl92TWBdLQx{k~" />
                  <block type="cwSolidCircle" id="7EtFAMh5DW1G{G`7/iZ:">
                    <value name="RADIUS">
                      <shadow type="numNumber" id="g/dnxW}AA9ICRdf^hAZ%">
                        <field name="NUMBER">3</field>
                      </shadow>
                    </value>
                  </block>
                </value>
                <value name="COLOR">
                  <shadow type="cwBlack" id="lWMS6l9(cPM,##cv2T;9" />
                  <block type="cwWhite" id="QS#vsRu@oN7TMdQ8:rl[" />
                </value>
              </block>
            </value>
            <value name="X">
              <shadow type="numNumber" id="[=yTsqCw[en6@?[U{2MN">
                <field name="NUMBER">0</field>
              </shadow>
              <block type="numSin" id="g4}}*%xA57kLhDT/)i5,">
                <value name="VAL">
                  <shadow type="numNumber" id="Ppt)tH04dE2#mroG0~TO">
                    <field name="NUMBER">0</field>
                  </shadow>
                  <block type="numMult" id=";6KVY=Mdt3;1K;e)^Wtv">
                    <value name="LEFT">
                      <shadow type="numNumber" id="a!=6-LNLdXeV*wcd(A#Z">
                        <field name="NUMBER">0</field>
                      </shadow>
                      <block type="vars_local" id="K{to-O31pTMX.Tx2u5qy">
                        <mutation name="x" parentid="M%]bzRjQgOc)AS1P-j0l" localid="0">
                          <type type="var" var="a232" />
                        </mutation>
                      </block>
                    </value>
                    <value name="RIGHT">
                      <shadow type="numNumber" id="Iq!D5x1ePLz{)VuG96wz">
                        <field name="NUMBER">100</field>
                      </shadow>
                    </value>
                  </block>
                </value>
              </block>
            </value>
            <value name="Y">
              <shadow type="numNumber" id="p7VD%RNp_}S5m^5JR)`u">
                <field name="NUMBER">5</field>
              </shadow>
            </value>
          </block>
        </value>
        <value name="PIC2">
          <block type="cwTranslate" id="BRN)=)W9H2k/{mo,^pYA">
            <value name="PICTURE">
              <shadow type="cwBlank" id="+d%xG1LQ=`YRz:vZ07C%" />
              <block type="cwColored" id="T-gJ%pdL)3cw=tGb@WPQ">
                <value name="PICTURE">
                  <shadow type="cwBlank" id="INutu}Pl92TWBdLQx{k~" />
                  <block type="cwSolidCircle" id="%hc,:nA`%i)8[ccI@nC}">
                    <value name="RADIUS">
                      <shadow type="numNumber" id="NR9Tjo1gm_{t*%k#kVYB">
                        <field name="NUMBER">5</field>
                      </shadow>
                    </value>
                  </block>
                </value>
                <value name="COLOR">
                  <shadow type="cwBlack" id="lWMS6l9(cPM,##cv2T;9" />
                  <block type="cwWhite" id="mwo*KU)9e7|{qYZh,@sl" />
                </value>
              </block>
            </value>
            <value name="X">
              <shadow type="numNumber" id="fbSAe4}ctn`|Pt.gTiFB">
                <field name="NUMBER">0</field>
              </shadow>
              <block type="numCos" id="o`y70[I.lc_0:hBmv4m-">
                <value name="VAL">
                  <shadow type="numNumber" id="[@)Sgi?71D1)sZ6YcW30">
                    <field name="NUMBER">0</field>
                  </shadow>
                  <block type="numMult" id="RCx%r#jA8i!3-*yqk!9~">
                    <value name="LEFT">
                      <shadow type="numNumber" id="1rH~_70L_HL5969)2[#5">
                        <field name="NUMBER">0</field>
                      </shadow>
                      <block type="vars_local" id="O:JY%r!EQyd;|Eo`OZ{a">
                        <mutation name="x" parentid="M%]bzRjQgOc)AS1P-j0l" localid="0">
                          <type type="literal" name="Number" />
                        </mutation>
                      </block>
                    </value>
                    <value name="RIGHT">
                      <shadow type="numNumber" id="LqG?6aIZww!%(;Z{zS~T">
                        <field name="NUMBER">100</field>
                      </shadow>
                    </value>
                  </block>
                </value>
              </block>
            </value>
            <value name="Y">
              <shadow type="numNumber" id="QV.!E)v,[LI7;RtGY3Ox">
                <field name="NUMBER">-5</field>
              </shadow>
            </value>
          </block>
        </value>
        <value name="PIC3">
          <block type="cwColored" id="ZlwwXi}#%VVJ=0ZLKk1u">
            <value name="PICTURE">
              <shadow type="cwBlank" id="INutu}Pl92TWBdLQx{k~" />
              <block type="cwSolidCircle" id="EYt+dxtk:8?iaCGf|{OR">
                <value name="RADIUS">
                  <shadow type="numNumber" id="[BqI/-{F!YVRKZ6vDK(o">
                    <field name="NUMBER">4</field>
                  </shadow>
                </value>
              </block>
            </value>
            <value name="COLOR">
              <shadow type="cwBlack" id="lWMS6l9(cPM,##cv2T;9" />
              <block type="cwWhite" id="meGEysaqC},]|/0_WM)A" />
            </value>
          </block>
        </value>
      </block>
    </value>
  </block>
  <block type="procedures_letFunc" id="99^O)|-dF8H~vAoy3@LP" x="124" y="505">
    <field name="NAME">background</field>
    <value name="RETURN">
      <block type="cwColored" id="@VPT`iu4]x_v}*!NfQe0">
        <value name="PICTURE">
          <shadow type="cwBlank" id="q[gfRD;m[Amz.d=BiSVr" />
          <block type="cwSolidRectangle" id="Vvb%8|,KM!fzpczGA?YS">
            <value name="WIDTH">
              <shadow type="numNumber" id="y`WJ1?W]ZH3KfRjpBwqv">
                <field name="NUMBER">20</field>
              </shadow>
            </value>
            <value name="HEIGHT">
              <shadow type="numNumber" id="oP(co}Rus-zoD7w;|,oh">
                <field name="NUMBER">20</field>
              </shadow>
            </value>
          </block>
        </value>
        <value name="COLOR">
          <shadow type="cwBlack" id="KIAk/Y}A#6VQ+R-DQm0v" />
          <block type="cwBlue" id="iJ~Y*a-hocG*;XW|RCOD" />
        </value>
      </block>
    </value>
  </block>
  <block type="procedures_letFunc" id="E+V{5s]1`i]ZH9YW,vuQ" x="121" y="625">
    <mutation>
      <arg name="t" />
    </mutation>
    <field name="NAME">winter</field>
    <value name="RETURN">
      <block type="cwCombine" id="W.1-o?HMsLB)4{Br(sBe">
        <mutation items="2" />
        <value name="PIC0">
          <shadow type="cwBlank" id="^8sc,0A#|T{e`Z}pCs4Q" />
          <block type="procedures_callreturn" id="m_fxzp8.+dT3E=G=yiQ8">
            <mutation name="snowman">
              <arg name="x" />
            </mutation>
            <value name="ARG0">
              <block type="vars_local" id="~L1}]ruxd-OKRuq|orhv">
                <mutation name="t" parentid="E+V{5s]1`i]ZH9YW,vuQ" localid="0">
                  <type type="var" var="a751" />
                </mutation>
              </block>
            </value>
          </block>
        </value>
        <value name="PIC1">
          <shadow type="cwBlank" id="_UJ2R+h71zb8ho#X=gq_" />
          <block type="procedures_callreturn" id=";4rTzHc-Vps^1(S}B}0H">
            <mutation name="background" />
          </block>
        </value>
      </block>
    </value>
  </block>
</xml>
cdsmith commented 7 years ago

Most of the XML looks fine, though it is a little odd that the inferred types of x are different at different sites.

Opening the mutator gives this:

Critical error blockly_compressed.js:1239
Object
  &: Scheme
  *: Scheme
  []: Scheme
  animationOf: Scheme
  background: Scheme
  blue: Scheme
  colored: Scheme
  cos: Scheme
  orange: Scheme
  sin: Scheme
  snowman: Scheme
  solidCircle: Scheme
  solidRectangle: Scheme
  thickArc: Scheme
  translated: Scheme
  undef: Scheme
  white: Scheme
  winter: Scheme
  __proto__: Object
blockly_compressed.js:1239
Unbound variable 'x' in expression: x