• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / js-slang / 13645552196

04 Mar 2025 03:23AM UTC coverage: 81.126%. Remained the same
13645552196

Pull #1742

github

web-flow
Merge 694cb981e into e35223ffb
Pull Request #1742: Rewrite: Stepper

3440 of 4608 branches covered (74.65%)

Branch coverage included in aggregate %.

10762 of 12898 relevant lines covered (83.44%)

143030.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

44.12
/src/typeChecker/internalTypeErrors.ts
1
import { UNKNOWN_LOCATION } from '../constants'
74✔
2
import { ErrorSeverity, ErrorType, Node, NodeWithInferredType, SourceError, Type } from '../types'
74✔
3
import { typeToString } from '../utils/stringify'
74✔
4
import * as tsEs from './tsESTree'
5

6
// tslint:disable:max-classes-per-file
7
export class TypeError implements SourceError {
74✔
8
  public type = ErrorType.TYPE
×
9
  public severity = ErrorSeverity.WARNING
×
10

11
  constructor(public node: NodeWithInferredType<Node>, public message: string) {
×
12
    node.typability = 'Untypable'
×
13
  }
14

15
  get location() {
16
    return this.node.loc ?? UNKNOWN_LOCATION
×
17
  }
18
  public explain() {
19
    return this.message
×
20
  }
21
  public elaborate() {
22
    return this.message
×
23
  }
24
}
25

26
/**
27
 * Temporary error that will eventually be converted to TypeError as some errors are only thrown
28
 * where there is no handle to the node
29
 */
30
export class InternalTypeError extends Error {
74✔
31
  // constructor(public message: string, ...params: any[]) {
32
  //   super(...params)
33
  // }
34
  constructor(public message: string) {
×
35
    super()
×
36
  }
37
}
38

39
export class UnifyError extends InternalTypeError {
74✔
40
  constructor(public LHS: Type, public RHS: Type) {
×
41
    super(`Failed to unify LHS: ${typeToString(LHS)}, RHS: ${typeToString(RHS)}`)
×
42
  }
43
}
44

45
export class InternalDifferentNumberArgumentsError extends InternalTypeError {
74✔
46
  constructor(public numExpectedArgs: number, public numReceived: number) {
×
47
    super(`Expected ${numExpectedArgs} args, got ${numReceived}`)
×
48
  }
49
}
50

51
export class InternalCyclicReferenceError extends InternalTypeError {
74✔
52
  constructor(public name: string) {
×
53
    super(`contains a cyclic reference to itself`)
×
54
  }
55
}
56

57
export class TypecheckError implements SourceError {
74✔
58
  public type = ErrorType.TYPE
1✔
59
  public severity = ErrorSeverity.WARNING
1✔
60

61
  constructor(public node: tsEs.Node | tsEs.TSType, public message: string) {}
1✔
62

63
  get location() {
64
    return this.node.loc ?? UNKNOWN_LOCATION
5!
65
  }
66
  public explain() {
67
    return this.message
1✔
68
  }
69
  public elaborate() {
70
    return this.message
×
71
  }
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc