GrammaticalFramework/gf-core

Compilation hangs on an error in functor

inariksit opened this issue · 0 comments

The problem

Say you are implementing the Foods grammar (any language will do, I chose German arbitrarily) and make the following typo.

concrete FoodsGer of Foods = FoodsI with 
  (Syntax = SyntaxGer),
  (LexFoods = LexFoods) ;

That is, the last line says (LexFoods = LexFoods), instead the expected (LexFoods = LexFoodsGer).

When compiling the grammar, it just hangs without any errors, stopping at the type checking phase.

$ gf -v FoodsGer.gf
…
- parsing FoodsGer.gf
  renaming 
  type checking  

Interestingly, if I typo the line (Syntax=SyntaxGer) as (Syntax=Syntax), I get an error immediately. This gets printed for every function in the grammar, I omitted the rest for brevity.

- parsing FoodsGer.gf
  renaming 
  type checking 

FoodsGer.gf:
   /Users/inari/work/GF/gf-contrib/foods/FoodsI.gf:19:
     Happened in linearization of Wine
      no overload instance of Syntax.mkCN
      with value type {s : Str}
      for argument list
        {s : Number => Case => Str; co : Str; g : Gender; lock_N : {};
         uncap : {s : Number => Case => Str; co : Str}}
      among alternatives
        N
        …
        CN NP
FoodsGer.gf:
   /Users/inari/work/GF/gf-contrib/foods/FoodsI.gf:17:
     Happened in linearization of Very
      cannot infer type of constant very_AdA

Not related to MonadFail

I rolled back to a version from February, and I get the same behaviour. So this cannot be related to the MonadFail fix that caused the infinite loop in #79.