Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C curry-frontend
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 71
    • Issues 71
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • curry
  • curry-frontend
  • Merge requests
  • !37

Improve message spans in TypeCheck

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Fredrik Wieczerkowski requested to merge improve-typecheck-message-spans into master Oct 29, 2020
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 1

Fixes #93 (closed)

This branch improves the messages from the TypeCheck by always using the span from the innermost expression in which the type error occurred.

Consider the example from the issue that now emits the following error message:

1:8-1:24 Error:
    Type error in application
    not (f True True)
     
    Term: (f True True)
    Inferred type: [Prelude.Char]
    Expected type: Prelude.Bool
    Types Prelude.Bool and [Prelude.Char] are incompatible
   | 
 1 | test = not (f True True)
   |        ^^^^^^^^^^^^^^^^^

Nested expressions now also yield a better span:

test = 23 + (3 * True) / 4
1:14-1:21 Error:
    Missing instance for Prelude.Num Prelude.Bool
    in infix application
    3 * True
     
    Term: True
   | 
 1 | test = 23 + (3 * True) / 4
   |              ^^^^^^^^
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: improve-typecheck-message-spans