File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed 
cabal-install-solver/src/Distribution/Solver/Modular 
cabal-install/tests/UnitTests/Distribution/Solver/Modular Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -282,16 +282,16 @@ showOption qpn@(Q _pp pn) (POption i linkedTo) =
282282--  >>> showOptions foobarQPN [k1, k2] 
283283--  "foo-bar; foo-bar~>bazqux.foo-bar-1, foo-bar~>bazqux.foo-bar-2" 
284284--  >>> showOptions foobarQPN [v0, i1, k2] 
285- --  "foo-bar; 0, 1/installed-inplace, foo-bar~>bazqux.foo-bar-2" 
285+ --  "foo-bar; 0, 1/installed-inplace, foo-bar~>bazqux.foo-bar-2 and earlier versions " 
286286showOptions  ::  QPN  ->  [POption ] ->  String 
287287showOptions _ []  =  " unexpected empty list of versions" 
288288showOptions q [x] =  showOption q x
289289showOptions q xs =  showQPN q ++  " ; " ++  (L. intercalate " , " 
290290  [if  isJust linkedTo
291291    then  showOption q x
292292    else  showI i --  Don't show the package, just the version
293-   |  x@ (POption  i linkedTo) <-  xs
294-   ])
293+   |  x@ (POption  i linkedTo) <-  take   3   xs
294+   ]  ++   if   length  xs  >=   3   then   "  and earlier versions "   else   " " 
295295
296296showGR  ::  QGoalReason  ->  String 
297297showGR UserGoal             =  "  (user goal)" 
Original file line number Diff line number Diff line change @@ -964,6 +964,19 @@ tests =
964964                  skipping =  " skipping: A; 2.0.0/installed-2.0.0, 1.0.0/installed-1.0.0" 
965965               in  mkTest db " show skipping versions list, installed" " B" $ 
966966                    solverFailure (\ msg ->  rejecting `isInfixOf`  msg &&  skipping `isInfixOf`  msg)
967+           , runTest $ 
968+               let  db = 
969+                     [ Right $  exAv " A" 1  [] 
970+                     , Right $  exAv " A" 2  [] 
971+                     , Right $  exAv " A" 3  [] 
972+                     , Right $  exAv " A" 4  [] 
973+                     , Right $  exAv " A" 5  [] 
974+                     , Right $  exAv " B" 1  [ExFix  " A" 6 ]
975+                     ]
976+                   rejecting =  " rejecting: A-5.0.0 (conflict: B => A==6.0.0)" 
977+                   skipping =  " skipping: A; 4.0.0, 3.0.0, 2.0.0 and earlier versions (has" 
978+                in  mkTest db " show summarized skipping versions list" " B" $ 
979+                     solverFailure (\ msg ->  rejecting `isInfixOf`  msg &&  skipping `isInfixOf`  msg)
967980          ]
968981      ]
969982  ]
Original file line number Diff line number Diff line change 1+ synopsis: Solver: shorten the skipping message if needed
2+ packages: cabal-install-solver
3+ prs: #11062
4+ 
5+ When the solver fails to find a solution, it can print out a long list
6+ of package versions which failed to meet the requirements. This PR
7+ shortens the message to at most 3 versions which failed to meet the
8+ requriements.
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments