Record coercion can turn an immutable field into a mutable one
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 57/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- ocaml
- Domínio
- compilers
Direção de pesquisa
Start with Record_coercion.check_record_fields in compiler/ml/record_coercion.ml and read how it checks field names, optionality, runtime names, and field type subtyping. Trace the coercion checks for immutable and mutable fields, then add coverage for the shown ro to rw case and for fields mutable on both sides. Done when the first coercion is rejected and the mutable-to-mutable case requires equal field types.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
What happens
:> between record types accepts a target whose field is mutable when the source's field is not:
type ro = {x: float}
type rw = {mutable x: float}
let toRw = (r: ro) => (r :> rw)
compiles on master (1a49d918e) to
function toRw(r) {
return r;
}
So a value typed ro, whose x the type system treats as immutable, can be written through the coerced view:
let r: ro = {x: 0.}
let w = (r :> rw)
w.x = 1. // compiles; r.x is now 1.
Where
Record_coercion.check_record_fields (compiler/ml/record_coercion.ml) compares field names, optionality and runtime names, and passes the field types on for subtyping; it does not compare mutability.
Expected
A coercion should not grant write access the source does not have: a mutable target field requires a mutable source field. Where both are mutable, the field type is read and written, so it has to be equal (invariant) rather than a subtype.
- Linguagem predominante
- OCaml
- Estrelas
- 7.5k
- Forks
- 483
- Merge médio
- 20h 19min
- PRs com merge (30d)
- 242
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de rescript-lang/rescript
-
Record coercion can construct a private record from outside its moduleTalvez já em andamento @cknitt assumiu hoje. Aberta
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 52/100
rescript-lang/rescript#9124 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 56/100
rescript-lang/rescript#9123 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 55/100
rescript-lang/rescript#9122 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
rescript-lang/rescript#9109 ·
Mantenedores costumam responder em até 1 dia
-
Formatter: five cases where comments and doc comments are placed wronglyTalvez já em andamento @cknitt assumiu hoje. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
rescript-lang/rescript#9107 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de rescript-lang/rescript
Issues semelhantes
-
[MLIR][TOSA] Assertion in verifyBlockScaledTensorType when a tosa op result type is not a tensorAbertacrash mlir:tosa
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
llvm/llvm-project#236561 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
A-lexer
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
oxc-project/oxc#28320 ·
Mantenedores costumam responder em até 1 dia
-
[python] Python library model: str(None) is modelled as an unconstrained string instead of "None"Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
area:codegen backend:spirv bug direction:input
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
log1p loses all precision for small |x| wherever the polyfill runs (LLVM backend, Metal, WGSL)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia