Skip to content

Commit

Permalink
BUG#36211402 Avoid field assignment on "super"
Browse files Browse the repository at this point in the history
TypeScript/JavaScript uses prototype-based inheritance where fields are
stored in a flat structure and not in the scope of a particular class
definition in the hierarchy. This means that a field specified by a
parent class can be replaced by one specified by one of the children.

To signal this behaviour, starting in v5.3.0, the TypeScript compiler
prevents a class from assigning values to fields specified by a parent
class using "super"
(microsoft/TypeScript#54056).

This patch, upgrades the TypeScript compiler to the latest version and
fixes the remaining issues related to the topic mentioned above that
now result in compiler errors. Additionally, it also updates the launch
task that runs the compiler to ensure it uses a local version of the
compiler, as specified by the dependency graph of the VSCode Extension
package.

Change-Id: Ib3ef774028ec4587c6b8e5eaa2eb395188e0d5a1
  • Loading branch information
ruiquelhas committed Jan 23, 2024
1 parent 39e2663 commit 667eb98
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions gui/extension/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"label": "tsc: extension",
"type": "shell",
"command": "tsc",
"command": "./node_modules/.bin/tsc",
"args": [
"-w",
"-p",
Expand Down Expand Up @@ -72,7 +72,7 @@
{
"label": "tsc: e2e",
"type": "shell",
"command": "tsc",
"command": "./node_modules/.bin/tsc",
"args": [
"-w",
"-p",
Expand Down
1 change: 1 addition & 0 deletions gui/extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- BUG#36027690 Connection error when opening REST Object Request Path in Web Browser
- BUG#36032142 Unexpected error when deleting records with filter containing nullables
- BUG#36173373 Parent class field not accessible in the child class in the TypeScript SDK
- BUG#36211402 Unexpected compilation error when building the VSCode Extension

## Changes in 1.14.2+8.1.1

Expand Down
2 changes: 1 addition & 1 deletion gui/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@
"eslint-plugin-jsdoc": "46.8.2",
"eslint-plugin-prefer-arrow": "1.2.3",
"oci-mysql": "2.73.0",
"typescript": "5.2.2"
"typescript": "5.3.3"
},
"scripts": {
"build-dev-package": "vsce package",
Expand Down
8 changes: 4 additions & 4 deletions gui/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"selenium-webdriver": "4.16.0",
"terser": "5.24.0",
"ts-node": "10.9.1",
"typescript": "5.2.2",
"typescript": "5.3.3",
"vite": "4.5.0",
"vite-plugin-monaco-editor": "1.1.0"
},
Expand All @@ -95,4 +95,4 @@
"not ie <= 11",
"not op_mini all"
]
}
}
8 changes: 6 additions & 2 deletions gui/frontend/src/parsing/python/PythonLexerBase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023, Oracle and/or its affiliates.
* Copyright (c) 2021, 2024, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -48,7 +48,11 @@ export abstract class PythonLexerBase extends Lexer {
return super.emit();
}

super._token = token;
// The _token field is handled by the parent Lexer class, however, the TypeScript compiler now prevents field
// assignment using "super", because fields are kept in a flat structure in the prototype chain and there are no
// assurances they are not rewritten by the child classes.
// Until the Lexer class introduces a setter for this specific field, use we can replace "super" by "this".
this._token = token;
this.buffer.push(token);
this.lastToken = token;

Expand Down
2 changes: 1 addition & 1 deletion mrs_plugin/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prefer-arrow": "1.2.3",
"preact": "10.19.2",
"typescript": "4.9.5",
"typescript": "5.3.3",
"vitest": "0.33.0"
}
}

0 comments on commit 667eb98

Please sign in to comment.