Skip to content

Commit

Permalink
intergration commit2
Browse files Browse the repository at this point in the history
  • Loading branch information
sunrabbit123 committed Aug 30, 2023
1 parent 19ecbff commit 23a286d
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 43 deletions.
10 changes: 10 additions & 0 deletions crates/stc_ts_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1589,6 +1589,11 @@ pub enum ErrorKind {
RestParamMustBeLast {
span: Span,
},

// TS2536
CannotBeUsedToIndexType {
span: Span,
},
}

#[cfg(target_pointer_width = "64")]
Expand Down Expand Up @@ -2203,6 +2208,7 @@ impl ErrorKind {

ErrorKind::ImportFailed { .. } => 2305,

ErrorKind::CannotBeUsedToIndexType { .. } => 2536,
_ => 0,
}
}
Expand Down Expand Up @@ -2236,6 +2242,10 @@ impl ErrorKind {
matches!(self, Self::NoSuchType { .. } | Self::NoSuchTypeButVarExists { .. })
}

pub fn is_cannot_be_used_index_ty(&self) -> bool {
self.code() == 2536
}

#[cold]
pub fn flatten(vec: Vec<Error>) -> Vec<Error> {
let mut buf = Vec::with_capacity(vec.len());
Expand Down
1 change: 1 addition & 0 deletions crates/stc_ts_type_checker/tests/conformance.pass.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2428,6 +2428,7 @@ types/nonPrimitive/nonPrimitiveAndEmptyObject.ts
types/nonPrimitive/nonPrimitiveAndTypeVariables.ts
types/nonPrimitive/nonPrimitiveAsProperty.ts
types/nonPrimitive/nonPrimitiveAssignError.ts
types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts
types/nonPrimitive/nonPrimitiveInFunction.ts
types/nonPrimitive/nonPrimitiveInGeneric.ts
types/nonPrimitive/nonPrimitiveIndexingWithForIn.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required_errors": {},
"required_error_lines": {},
"extra_errors": {
"TS2345": 8,
"TS2345": 9,
"TS2339": 2,
"TS0": 2,
"TS2322": 8
Expand All @@ -11,6 +11,7 @@
"TS2345": [
96,
132,
162,
291,
295,
296,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 0,
matched_error: 5,
extra_error: 20,
extra_error: 21,
panic: 0,
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required_errors": {
"TS2339": 2,
"TS2322": 7,
"TS2322": 6,
"TS7053": 1,
"TS2536": 1
},
Expand All @@ -14,7 +14,6 @@
30,
34,
41,
55,
56,
70,
71
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 11,
matched_error: 12,
required_error: 10,
matched_error: 13,
extra_error: 2,
panic: 0,
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
"TS2322": 12,
"TS2536": 4,
"TS2542": 4
"TS2536": 2,
"TS2542": 4,
"TS2322": 10
},
"required_error_lines": {
"TS2536": [
23,
24
],
"TS2542": [
54,
59,
64,
69
],
"TS2322": [
14,
19,
Expand All @@ -18,25 +31,17 @@
161,
166,
171
],
"TS2536": [
23,
24,
28,
29
],
"TS2542": [
54,
59,
64,
69
]
},
"extra_errors": {
"TS2322": 5
"TS2322": 9
},
"extra_error_lines": {
"TS2322": [
13,
18,
23,
24,
39,
58,
59,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 20,
matched_error: 8,
extra_error: 5,
required_error: 16,
matched_error: 12,
extra_error: 9,
panic: 0,
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 1,
matched_error: 9,
required_error: 0,
matched_error: 10,
extra_error: 0,
panic: 0,
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"required_errors": {
"TS2345": 1,
"TS2344": 1,
"TS2322": 5,
"TS2322": 4,
"TS4104": 2
},
"required_error_lines": {
Expand All @@ -16,7 +16,6 @@
155,
185,
194,
206,
360
],
"TS4104": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 9,
matched_error: 11,
required_error: 8,
matched_error: 12,
extra_error: 18,
panic: 0,
}
6 changes: 3 additions & 3 deletions crates/stc_ts_type_checker/tests/tsc-stats.rust-debug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Stats {
required_error: 3500,
matched_error: 6535,
extra_error: 763,
required_error: 3493,
matched_error: 6542,
extra_error: 768,
panic: 73,
}

0 comments on commit 23a286d

Please sign in to comment.