@@ -301,7 +301,9 @@ function vm.isSubType(uri, child, parent, mark, errs)
301301 end
302302 end
303303 if hasKnownType > 0 then
304- if errs and hasKnownType > 1 then
304+ if errs
305+ and hasKnownType > 1
306+ and # vm .getInfer (child ):getSubViews (uri ) > 1 then
305307 errs [# errs + 1 ] = ' TYPE_ERROR_CHILD_ALL_DISMATCH'
306308 errs [# errs + 1 ] = child
307309 errs [# errs + 1 ] = parent
@@ -376,7 +378,9 @@ function vm.isSubType(uri, child, parent, mark, errs)
376378 end
377379 end
378380 if hasKnownType > 0 then
379- if errs and hasKnownType > 1 then
381+ if errs
382+ and hasKnownType > 1
383+ and # vm .getInfer (parent ):getSubViews (uri ) > 1 then
380384 errs [# errs + 1 ] = ' TYPE_ERROR_PARENT_ALL_DISMATCH'
381385 errs [# errs + 1 ] = child
382386 errs [# errs + 1 ] = parent
@@ -703,6 +707,7 @@ local ErrorMessageMap = {
703707--- @return string
704708function vm .viewTypeErrorMessage (uri , errs )
705709 local lines = {}
710+ local mark = {}
706711 local index = 1
707712 while true do
708713 local name = errs [index ]
@@ -741,8 +746,17 @@ function vm.viewTypeErrorMessage(uri, errs)
741746 index = index + 1
742747 end
743748 local line = lang .script (name , lparams )
744- lines [# lines + 1 ] = ' - ' .. line
749+ if not mark [line ] then
750+ mark [line ] = true
751+ lines [# lines + 1 ] = ' - ' .. line
752+ end
745753 end
746754 util .revertTable (lines )
747- return table.concat (lines , ' \n ' )
755+ if # lines > 15 then
756+ lines [13 ] = (' ...(+%d)' ):format (# lines - 15 )
757+ table.move (lines , # lines - 2 , # lines , 14 )
758+ return table.concat (lines , ' \n ' , 1 , 16 )
759+ else
760+ return table.concat (lines , ' \n ' )
761+ end
748762end
0 commit comments