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

source-academy / js-slang / 12904208937

22 Jan 2025 08:32AM UTC coverage: 81.63% (-0.02%) from 81.654%
12904208937

Pull #1630

github

web-flow
Merge aa16b5a7d into 8ead9f26e
Pull Request #1630: Upgrade gl to v8, Prettier to v3

3654 of 4864 branches covered (75.12%)

Branch coverage included in aggregate %.

63 of 84 new or added lines in 13 files covered. (75.0%)

7 existing lines in 3 files now uncovered.

11499 of 13699 relevant lines covered (83.94%)

140593.93 hits per line

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

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

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

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

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

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

42
export class UnifyError extends InternalTypeError {
79✔
43
  constructor(
NEW
44
    public LHS: Type,
×
NEW
45
    public RHS: Type
×
46
  ) {
UNCOV
47
    super(`Failed to unify LHS: ${typeToString(LHS)}, RHS: ${typeToString(RHS)}`)
×
48
  }
49
}
50

51
export class InternalDifferentNumberArgumentsError extends InternalTypeError {
79✔
52
  constructor(
NEW
53
    public numExpectedArgs: number,
×
NEW
54
    public numReceived: number
×
55
  ) {
UNCOV
56
    super(`Expected ${numExpectedArgs} args, got ${numReceived}`)
×
57
  }
58
}
59

60
export class InternalCyclicReferenceError extends InternalTypeError {
79✔
61
  constructor(public name: string) {
×
62
    super(`contains a cyclic reference to itself`)
×
63
  }
64
}
65

66
export class TypecheckError implements SourceError {
79✔
67
  public type = ErrorType.TYPE
1✔
68
  public severity = ErrorSeverity.WARNING
1✔
69

70
  constructor(
71
    public node: tsEs.Node | tsEs.TSType,
1✔
72
    public message: string
1✔
73
  ) {}
74

75
  get location() {
76
    return this.node.loc ?? UNKNOWN_LOCATION
5!
77
  }
78
  public explain() {
79
    return this.message
1✔
80
  }
81
  public elaborate() {
82
    return this.message
×
83
  }
84
}
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

© 2025 Coveralls, Inc