Page 1 of 1

Problem with incompatible types

Posted: 2 Sep 2017 13:14
by Martin Meyer
Hello Thomas,

please have a look at below stripped down version of my code. It throws error c504 : The expression has type 'syntax_t_nt::grammarSymbol{::unsigned, ::unsigned}', which is incompatible with the type 'syntax_t_nt::grammarSymbol{@Terminal, @Nonterminal}' in VIP 8.0.0. How can I circumvent the problem?

Code: Select all

interface syntax_t_nt{@Terminal, @Nonterminal}   domains     grammarSymbol =         t(@Terminal T);         nt(@Nonterminal Nt).     grammarString = grammarSymbol*.   end interface syntax_t_nt   %======   interface cfg{@Terminal, @Nonterminal}     open syntax_t_nt{@Terminal, @Nonterminal}   predicates     isNullable : (grammarString GrmStrg) determ.   end interface cfg   %======   interface cfgSupportSite{@Terminal, @Nonterminal}   predicates from cfg{@Terminal, @Nonterminal}     isNullable/1   end interface cfgSupportSite   %======   class unsignedCfg : cfg{unsigned, unsigned} end class unsignedCfg   %---   implement unsignedCfg     open syntax_t_nt{unsigned, unsigned}     supports cfgSupportSite{unsigned, unsigned}   clauses     isNullable([nt(Nt) | RestGrmStrg]) :- %the error refers to nt(Nt) in this line         doSomethingWithAnUnsigned(Nt),         isNullable(RestGrmStrg).       isNullable([]).   predicates     doSomethingWithAnUnsigned : (unsigned). clauses     doSomethingWithAnUnsigned(_).   end implement unsignedCfg   %======   implement main   clauses     run() :-         _ = unsignedCfg::new().   end implement main

Posted: 4 Sep 2017 9:53
by Thomas Linder Puls
In this particular case a workaround is not to use open in the cfg interface:

We will of course look for a non-workaround solution as well.

Posted: 4 Sep 2017 17:38
by Martin Meyer
Thank you! I followed your advice and it works now.