alashworth / test-issue-import

0 stars 0 forks source link

Standalone compilation of functions does not complain when other program blocks are present #148

Open alashworth opened 5 years ago

alashworth commented 5 years ago

Issue by martinmodrak Friday Jun 16, 2017 at 07:22 GMT Originally opened as https://github.com/stan-dev/stan/issues/2330


Summary:

When a .stanfuncs file is passed to stanc, but it contains other blocks, the compiler is silent. It should give a warning or an error.

Description:

This was left unresolved when implementing #2267. When compiling standalone functions, it is definitely necessary to check whether other blocks are contained in the input file. I see two possible ways of doing this: 1) keep the default parser and check whether the members of stan::lang::program are all empty except function_decl_defs_ (requires maintanence when new types of program blocks are introduced or when the program struct changes) 2) create a specific parser variant that only recognizes the functions block (would require maintanance when the parser structure changes and a specific parser for other compilation modes would have to be created as well) At this time, I slightly prefer 1).

Should compile_functions() give a warning or error when other blocks are present? I am inclined to just a warning, but not sure.

Current Version:

v2.15.0