Cuis-Smalltalk / Cuis-Smalltalk-Dev

Active development of Cuis Smalltalk
MIT License
433 stars 71 forks source link

Cannot invoke `Do it` on an object inspector with an expression containing undefined variables #221

Open npapagna opened 2 years ago

npapagna commented 2 years ago

Describe the bug Invoking Do it in an object inspector with a selection containing undefined variables fails.

To Reproduce

Follow these steps for all scenarios:

  1. Inspect Object new.
  2. In the object inspector, evaluate a _ self. a printString..
  3. The Unknown variable dialog shows up.

1) Block-Local/Method-Local temporary scenario

  1. Select block-local temp/method-local temp
  2. Notice that Do it failed, and the source code got messed up:
    a Nothing more expected ->_ se| a |
    lf. a printString.

2) Instance variable scenario

  1. Select instance
  2. Notice that the debugger is opened because of Error: a is already defined in a subclass of Object
  3. Change the script so that the undefined variable has an unused name (e.g. aaa _ self. aaa printString.)
  4. Notice that the system actually tried to define that instance variable, but it did not because in this case, Object cannot be changed.

Expected behavior I was expecting the evaluation panel in the debugger to behave more like a workspace than a debugger (e.g. to avoid defining instance variables if I am doing experiments with a script).

Screenshots

Block-Local/Method-Local temporary scenario:

https://user-images.githubusercontent.com/1807185/147976949-ac5dc782-836a-4827-b4ca-57e4228cab06.mp4

Instance variable scenario:

https://user-images.githubusercontent.com/1807185/147976983-d8218cd3-43bd-40ff-8f15-e17de8d01568.mp4

Additional context N/A

nmingotti commented 2 years ago

please, always post your question cuis-dev@lists.cuis.st . It has more chances to be seen and answered !

npapagna commented 2 years ago

please, always post your question cuis-dev@lists.cuis.st . It has more chances to be seen and answered !

Yup! I was writing the email as this comment came in. Thanks for the reminder @nmingotti 🎉