False error: a boolean query (_ == true --> open(this)) in a class fails at its return

Aberta
#509 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
54/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
java

Direção de pesquisa

Start by tracing how @Refinement is checked on a method body and how the return refinement's this reference is represented when the return statement is checked. Compare that path with the external spec case described for Scanner.hasNext(). Done means the ordinary class example compiles with the stated refinement while the existing external spec behavior still works.

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

Descrição

bug

Problem. A boolean query in an ordinary class, a method whose return refinement relates its result to the state of this, fails when its body is checked:

import liquidjava.specification.*;

@StateSet({"unlocked", "locked"})
public class QueryShorthand {
    @StateRefinement(to = "locked(this)")
    public QueryShorthand() {}

    @Refinement("_ == true --> unlocked(this)")
    public boolean isUnlocked() {
        return true;
    }
}
Argument Mismatch Error: Argument '#ret_1' and its respective parameter of ghost 'QueryShorthand.state1' types are incompatible: expected QueryShorthand, got boolean

The same refinement works on an external spec (_ == true --> hasMore(this) on Scanner.hasNext()), whose methods have no body. When the return is checked, the state's argument seems to become the returned value instead of this.

Found while writing tests for #502.

Linguagem predominante
Java
Estrelas
73
Forks
38
Merge médio
12h 32min
PRs com merge (30d)
45

Preparar o ambiente

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 liquid-java/liquidjava

Todas as issues de liquid-java/liquidjava

Issues semelhantes

Mais issues de Java

Receba novas issues na sua caixa de entrada

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