Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Type variable names should be retained #4

Open
@dsheets

Description

@dsheets

In error messages regarding polymorphic values, it would be nice to have the names of type variables retained.

For instance:

class ['repo, 'pkg] universe :
object ('self)
  constraint 'repo =
  < filter        : ('repo -> 'pkg -> bool) -> 'repo;
    map           : ('repo -> 'pkg -> 'pkg) -> 'repo;
    name          : string;
    opam          : OpamTypes.repository;
    packages      : 'pkg OpamPackage.Map.t;
    priority      : int;
    with_priority : int -> 'repo;
    ..
  >

but then when a type error is printed:

A type parameter has type
         < filter : ('b -> < package : OpamPackage.Set.elt; .. > -> bool) ->
                    'a;
           map : 'c -> 'a; name : OpamRepositoryName.Map.key;
           opam : OpamTypes.repository;
           packages : < conflicts : OpamTypes.formula;
                        depends : OpamTypes.formula;
                        depopts : OpamTypes.formula; .. >
                      OpamPackage.Map.t;
           priority : int; with_priority : int -> 'a; .. >
         as 'a
       but is expected to have type
         < filter : ('d ->
                     (< conflicts : OpamTypes.formula;
                        depends : OpamTypes.formula;
                        depopts : OpamTypes.formula;
                        package : OpamTypes.package; .. >
                      as 'e) ->
                     bool) ->
                    'd;
           map : ('d -> 'e -> 'e) -> 'd; name : string;
           opam : OpamTypes.repository; packages : 'e OpamPackage.Map.t;
           priority : int; with_priority : int -> 'd; .. >
         as 'd
       This instance of 'd is ambiguous:
       it would escape the scope of its equation

This probably requires annotation and a disambiguation pass before error printing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions