@@ -12,7 +12,7 @@ mod tests {
1212 use std:: path:: PathBuf ;
1313
1414 use crate :: {
15- compile:: { ExecErrorKind , SolvedValue } ,
15+ compile:: { ExecErrorKind , SolvedValue , StaticErrorKind } ,
1616 gds:: GdsMap ,
1717 parse:: parse_workspace_with_std,
1818 } ;
@@ -59,6 +59,8 @@ mod tests {
5959 const ARGON_ANY_TYPE : & str = concatcp ! ( EXAMPLES_DIR , "/any_type/lib.ar" ) ;
6060 const ARGON_SEQ_INDEX : & str = concatcp ! ( EXAMPLES_DIR , "/seq_index/lib.ar" ) ;
6161 const ARGON_SEQ_CONSTRUCTOR : & str = concatcp ! ( EXAMPLES_DIR , "/seq_constructor/lib.ar" ) ;
62+ const ARGON_FUNC_BAD_ARG_REUSE : & str = concatcp ! ( EXAMPLES_DIR , "/func_bad_arg_reuse/lib.ar" ) ;
63+ const ARGON_CELL_BAD_ARG_REUSE : & str = concatcp ! ( EXAMPLES_DIR , "/cell_bad_arg_reuse/lib.ar" ) ;
6264
6365 #[ test]
6466 fn argon_scopes ( ) {
@@ -781,4 +783,52 @@ mod tests {
781783 assert_relative_eq ! ( r. x1. 0 , 300. , epsilon = EPSILON ) ;
782784 assert_relative_eq ! ( r. y1. 0 , 500. , epsilon = EPSILON ) ;
783785 }
786+
787+ #[ test]
788+ fn argon_func_bad_arg_reuse ( ) {
789+ let o = parse_workspace_with_std ( ARGON_FUNC_BAD_ARG_REUSE ) ;
790+ assert ! ( o. static_errors( ) . is_empty( ) ) ;
791+ let ast = o. ast ( ) ;
792+ let cells = compile (
793+ & ast,
794+ CompileInput {
795+ cell : & [ "top" ] ,
796+ args : Vec :: new ( ) ,
797+ lyp_file : & PathBuf :: from ( BASIC_LYP ) ,
798+ } ,
799+ ) ;
800+ println ! ( "{cells:#?}" ) ;
801+
802+ let errors = cells. unwrap_static_errors ( ) ;
803+ assert ! (
804+ errors
805+ . errors
806+ . iter( )
807+ . any( |e| matches!( e. kind, StaticErrorKind :: UndeclaredVar ) )
808+ ) ;
809+ }
810+
811+ #[ test]
812+ fn argon_cell_bad_arg_reuse ( ) {
813+ let o = parse_workspace_with_std ( ARGON_CELL_BAD_ARG_REUSE ) ;
814+ assert ! ( o. static_errors( ) . is_empty( ) ) ;
815+ let ast = o. ast ( ) ;
816+ let cells = compile (
817+ & ast,
818+ CompileInput {
819+ cell : & [ "top" ] ,
820+ args : Vec :: new ( ) ,
821+ lyp_file : & PathBuf :: from ( BASIC_LYP ) ,
822+ } ,
823+ ) ;
824+ println ! ( "{cells:#?}" ) ;
825+
826+ let errors = cells. unwrap_static_errors ( ) ;
827+ assert ! (
828+ errors
829+ . errors
830+ . iter( )
831+ . any( |e| matches!( e. kind, StaticErrorKind :: UndeclaredVar ) )
832+ ) ;
833+ }
784834}
0 commit comments