source-academy / py-slang

Python sublanguage for SICP
Apache License 2.0
0 stars 0 forks source link

There is no InvalidNumberError in TokenizerErrors #14

Closed JothamWong closed 3 months ago

JothamWong commented 3 months ago

This is a current bug in the implementation where in your baseNumber implementation, you attempt to call a method that does not exist in the namespace.

This is easily reproducible but just calling yarn build will result in the following error

$ node ./scripts/updateAutocompleteDocs.js
src/py-slang/src/tokenizer.ts:228:47 - error TS2339: Property 'InvalidNumberError' does not exist on type 'typeof TokenizerErrors'.

228                     throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);
                                                  ~~~~~~~~~~~~~~~~~~

src/py-slang/src/tokenizer.ts:237:47 - error TS2339: Property 'InvalidNumberError' does not exist on type 'typeof TokenizerErrors'.

237                     throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);
                                                  ~~~~~~~~~~~~~~~~~~

src/py-slang/src/tokenizer.ts:246:47 - error TS2339: Property 'InvalidNumberError' does not exist on type 'typeof TokenizerErrors'.

246                     throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);
                                                  ~~~~~~~~~~~~~~~~~~

src/py-slang/src/tokenizer.ts:268:51 - error TS2339: Property 'InvalidNumberError' does not exist on type 'typeof TokenizerErrors'.

268                         throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);
                                                      ~~~~~~~~~~~~~~~~~~

src/py-slang/src/tokenizer.ts:296:43 - error TS2339: Property 'InvalidNumberError' does not exist on type 'typeof TokenizerErrors'.

296                 throw new TokenizerErrors.InvalidNumberError(this.line, this.col, this.source, this.start, this.current);
                                              ~~~~~~~~~~~~~~~~~~

Found 5 errors.
Fidget-Spinner commented 3 months ago

Hmm this seems to be an actual bug.

@JJtan2002 could you please add the error to https://github.com/source-academy/py-slang/blob/0b7801a69a670d4cbda8531c1a738b0fb66ea942/src/errors.ts#L126 ? You can copy one of the other errors in that file already. I think it should be interesting. If you have midterms and are busy just ignore my message for now please. Thanks!