@@ -918,6 +918,7 @@ let s:export_script_lines =<< trim END
918918 export def Exported (): string
919919 return ' Exported'
920920 enddef
921+ export final theList = [1 ]
921922END
922923
923924def Undo_export_script_lines ()
@@ -945,6 +946,10 @@ def Test_vim9_import_export()
945946 exp_name ..= ' Doe'
946947 g: imported_name_appended = exp_name
947948 g: imported_later = exported
949+
950+ import theList from ' ./Xexport.vim'
951+ theList- >add (2 )
952+ assert_equal ([1 , 2 ], theList)
948953 END
949954
950955 writefile (import_script_lines, ' Ximport.vim' )
@@ -1144,6 +1149,18 @@ def Test_vim9_import_export()
11441149 writefile (import_assign_to_const, ' Ximport.vim' )
11451150 assert_fails (' source Ximport.vim' , ' E46:' , ' ' , 1 , ' _Assign' )
11461151
1152+ # try changing an imported final
1153+ var import_assign_to_final = << trim END
1154+ vim9script
1155+ import theList from ' ./Xexport.vim'
1156+ def Assign ()
1157+ theList = [2 ]
1158+ enddef
1159+ defcompile
1160+ END
1161+ writefile (import_assign_to_final, ' Ximport.vim' )
1162+ assert_fails (' source Ximport.vim' , ' E46:' , ' ' , 1 , ' _Assign' )
1163+
11471164 # import a very long name, requires making a copy
11481165 var import_long_name_lines = << trim END
11491166 vim9script
0 commit comments