Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Printed type declarations drop @tag, @notUndefined and runtime annotations

Aberta
#9,134 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@cknitt já está trabalhando nisso.

Desde 30/10/2026.

  • #9136 de @cknitt — aberto

Avaliação

Dificuldade
4/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
25/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
ocaml
Domínio
compilers

Direção de pesquisa

Start with Printtyp.tree_of_type_decl, which the issue identifies as the printer used by error messages, hover, and createInterface. Compare its handling of @unboxed and @immediate with @tag, @notUndefined, @typeOf, and @instanceOf; use the named expected-output files and the applied-functor example to check the affected paths. Done means printed declarations retain these annotations in diagnostics, hover, and generated interfaces. An open linked pull request already tracks the work.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Printed type declarations keep @unboxed and @immediate, but drop the other annotations of a declaration: @tag, @notUndefined and the runtime annotations (@typeOf, @instanceOf). @as on fields and constructors is kept. The printer is Printtyp.tree_of_type_decl, used by error messages, hover and createInterface.

Error messages. The declaration the message is about is printed without the annotation it names:

module M: {
  @tag("kind") type v = Circle({r: float}) | Square({side: float})
} = {
  @tag("type") type v = Circle({r: float}) | Square({side: float})
}
Type declarations do not match:
  type v = Circle({r: float}) | Square({side: float})
is not included in
  type v = Circle({r: float}) | Square({side: float})
...
Their @tag annotations differ.

The same happens with @notUndefined (tests/build_tests/super_errors/expected/not_undefined_functor_argument.res.expected, where the expected side prints as type t) and with @typeOf (runtime_annotation_interface_over_record.res.expected).

Generated interfaces. createInterface prints a type when it cannot copy its source, as for a type of an applied functor. The annotation is lost and the interface does not match its implementation:

module Make = (X: {type t}) => {
  @tag("kind") type wrapped = Value({value: X.t}) | Empty({reason: string})
}

module Applied = Make({
  type t = int
})

The generated interface has module Applied: { type wrapped = Value({value: int}) | Empty({reason: string}) }, and compiling it with the implementation fails:

In module Applied:
Type declarations do not match:
  type wrapped = Applied.wrapped = Value({value: int}) | Empty({reason: string})
is not included in
  type wrapped = Value({value: int}) | Empty({reason: string})
...
Their @tag annotations differ.

Hover prints types the same way, so it hides these annotations too.

Linguagem predominante
OCaml
Estrelas
7.5k
Forks
484
Merge médio
21h 9min
PRs com merge (30d)
255

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de rescript-lang/rescript

Todas as issues de rescript-lang/rescript

Issues semelhantes

Mais issues de Compilers

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.