Skip to content

revert #1353: revert runtime type check to compile time check for Array#flat #2416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ under the licensing terms detailed in LICENSE:
* Roman F. <[email protected]>
* Joe Pea <[email protected]>
* Felipe Gasper <[email protected]>
* Congcong Cai <[email protected].com>
* Congcong Cai <congcongcai0907@163.com>
* mooooooi <[email protected]>
* Yasushi Ando <[email protected]>
* Syed Jafri <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions std/assembly/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { COMPARATOR, SORT } from "./util/sort";
import { REVERSE } from "./util/bytes";
import { joinBooleanArray, joinIntegerArray, joinFloatArray, joinStringArray, joinReferenceArray } from "./util/string";
import { idof, isArray as builtin_isArray } from "./builtins";
import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_ILLEGALGENTYPE, E_EMPTYARRAY, E_HOLEYARRAY } from "./util/error";
import { E_INDEXOUTOFRANGE, E_INVALIDLENGTH, E_EMPTYARRAY, E_HOLEYARRAY } from "./util/error";

// @ts-ignore: decorator
@inline @lazy const MIN_SIZE: usize = 8;
Expand Down Expand Up @@ -494,7 +494,7 @@ export class Array<T> {

flat(): T {
if (!isArray<T>()) {
throw new TypeError(E_ILLEGALGENTYPE);
ERROR("Cannot call flat() on Array<T> where T is not an Array.");
}
// Get the length and data start values
var ptr = this.dataStart;
Expand Down
4 changes: 0 additions & 4 deletions std/assembly/util/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export const E_VALUEOUTOFRANGE: string = "Value out of range";
@lazy @inline
export const E_INVALIDLENGTH: string = "Invalid length";

// @ts-ignore: decorator
@lazy @inline
export const E_ILLEGALGENTYPE: string = "Illegal generic type";

// @ts-ignore: decorator
@lazy @inline
export const E_EMPTYARRAY: string = "Array is empty";
Expand Down