-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
75 additions
and
30 deletions.
There are no files selected for viewing
24 changes: 12 additions & 12 deletions
24
inputs/passing/contentHashing/compareClassInstancesWithEqualSources.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
//! test_output([true,true,true,true,true]) | ||
//! test_output([true,true,true,true,true,true]) | ||
|
||
// When functions (and therefore classes) have the same source (and references), they should compare | ||
// equal due to the content hash system. | ||
|
||
export default () => { | ||
const a = new classes[0](1, 2); | ||
const b = new classes[1](1, 2); | ||
const a = new pointClasses.V1(3, 5); | ||
const b = new pointClasses.V2(3, 5); | ||
|
||
return [ | ||
a === b, | ||
// classes[0] === classes[1], TODO: Compare actual classes | ||
a instanceof classes[0], | ||
a instanceof classes[1], | ||
b instanceof classes[0], | ||
b instanceof classes[1], | ||
pointClasses.V1 === pointClasses.V2, | ||
a instanceof pointClasses.V1, | ||
a instanceof pointClasses.V2, | ||
b instanceof pointClasses.V1, | ||
b instanceof pointClasses.V2, | ||
]; | ||
}; | ||
|
||
const classes = [ | ||
class Point { | ||
const pointClasses = { | ||
V1: class Point { | ||
constructor(public x: number, public y: number) {} | ||
|
||
lenSq() { | ||
return this.x ** 2 + this.y ** 2; | ||
} | ||
}, | ||
class Point { | ||
V2: class Point { | ||
constructor(public x: number, public y: number) {} | ||
|
||
lenSq() { | ||
return this.x ** 2 + this.y ** 2; | ||
} | ||
}, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters