mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-31 07:23:06 +08:00
Keep the private-brand diagnostics on shapes that still refuse
Function-local classes whose private names are used only on `this` now compile, so the two diagnostics fixtures test a brand check on another object instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
afdb7706c1
commit
d204ef71d6
@@ -1,4 +1,4 @@
|
||||
function privateBrand() { return class { #value = 1; read(): number { return this.#value; } }; }
|
||||
function privateBrand() { return class { #value = 1; has(other: object): boolean { return #value in other; } }; }
|
||||
function selfName() { return class Local { copy() { return new Local(); } }; }
|
||||
class Base {}
|
||||
function derived() { return class extends Base {}; }
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
// The same speculative element-type query, reaching a function-local class
|
||||
// with a private brand through the function's returned array.
|
||||
// with a private brand through the function's returned array. The brand is
|
||||
// tested on another object, so the evaluations' private names must differ.
|
||||
function make() {
|
||||
class Box {
|
||||
#v = 1;
|
||||
read(): number {
|
||||
return this.#v;
|
||||
}
|
||||
same(other: object): boolean {
|
||||
return #v in other;
|
||||
}
|
||||
}
|
||||
return [new Box()];
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
local-class-boundaries.ts:1:34 - error SC1090: function-local classes with private brands are not supported yet
|
||||
|
||||
1 | function privateBrand() { return class { #value = 1; read(): number { return this.#value; } }; }
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
1 | function privateBrand() { return class { #value = 1; has(other: object): boolean { return #value in other; } }; }
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
2 | function selfName() { return class Local { copy() { return new Local(); } }; }
|
||||
|
||||
local-class-boundaries.ts:2:64 - error SC1090: named self references inside function-local classes are not supported yet
|
||||
|
||||
1 | function privateBrand() { return class { #value = 1; read(): number { return this.#value; } }; }
|
||||
1 | function privateBrand() { return class { #value = 1; has(other: object): boolean { return #value in other; } }; }
|
||||
2 | function selfName() { return class Local { copy() { return new Local(); } }; }
|
||||
| ^~~~~
|
||||
3 | class Base {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local-class-type-query-brand.ts:4:3 - error SC1090: function-local classes with private brands are not supported yet
|
||||
local-class-type-query-brand.ts:5:3 - error SC1090: function-local classes with private brands are not supported yet
|
||||
|
||||
3 | function make() {
|
||||
4 | class Box {
|
||||
4 | function make() {
|
||||
5 | class Box {
|
||||
| ^~~~~~~~~~~
|
||||
5 | #v = 1;
|
||||
6 | #v = 1;
|
||||
Reference in New Issue
Block a user