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

source-academy / js-slang / 13750610219

09 Mar 2025 05:01PM UTC coverage: 81.086% (-0.04%) from 81.126%
13750610219

Pull #1741

github

web-flow
Merge 561e360c2 into 6aad26cce
Pull Request #1741: Bump prettier, ace-builds, and misc clean up

3438 of 4606 branches covered (74.64%)

Branch coverage included in aggregate %.

66 of 89 new or added lines in 12 files covered. (74.16%)

9 existing lines in 4 files now uncovered.

10782 of 12931 relevant lines covered (83.38%)

143543.43 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'
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(
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 {
74✔
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 {
74✔
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 {
74✔
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 {
74✔
61
  constructor(public name: string) {
×
62
    super(`contains a cyclic reference to itself`)
×
63
  }
64
}
65

66
export class TypecheckError implements SourceError {
74✔
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