mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 05:51:48 +01:00 
			
		
		
		
	compiler:
- don't find MoveNext functions with the required arguments - add some test from Alexander S. Klenin (issue #0014990) git-svn-id: trunk@14044 -
This commit is contained in:
		
							parent
							
								
									5f7bc2d3b5
								
							
						
					
					
						commit
						2f0cde4625
					
				
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @ -8240,6 +8240,7 @@ tests/test/tforin19.pp svneol=native#text/pascal | |||||||
| tests/test/tforin2.pp svneol=native#text/pascal | tests/test/tforin2.pp svneol=native#text/pascal | ||||||
| tests/test/tforin20.pp svneol=native#text/pascal | tests/test/tforin20.pp svneol=native#text/pascal | ||||||
| tests/test/tforin21.pp svneol=native#text/pascal | tests/test/tforin21.pp svneol=native#text/pascal | ||||||
|  | tests/test/tforin22.pp svneol=native#text/pascal | ||||||
| tests/test/tforin3.pp svneol=native#text/pascal | tests/test/tforin3.pp svneol=native#text/pascal | ||||||
| tests/test/tforin4.pp svneol=native#text/pascal | tests/test/tforin4.pp svneol=native#text/pascal | ||||||
| tests/test/tforin5.pp svneol=native#text/pascal | tests/test/tforin5.pp svneol=native#text/pascal | ||||||
|  | |||||||
| @ -584,6 +584,8 @@ begin | |||||||
|       if movenext = nil then |       if movenext = nil then | ||||||
|       begin |       begin | ||||||
|         result:=cerrornode.create; |         result:=cerrornode.create; | ||||||
|  |         hloopvar.free; | ||||||
|  |         hloopbody.free; | ||||||
|         Message1(sym_e_no_enumerator_move,pd.returndef.GetTypeName); |         Message1(sym_e_no_enumerator_move,pd.returndef.GetTypeName); | ||||||
|       end |       end | ||||||
|       else |       else | ||||||
| @ -592,6 +594,8 @@ begin | |||||||
|         if current = nil then |         if current = nil then | ||||||
|         begin |         begin | ||||||
|           result:=cerrornode.create; |           result:=cerrornode.create; | ||||||
|  |           hloopvar.free; | ||||||
|  |           hloopbody.free; | ||||||
|           Message1(sym_e_no_enumerator_current,pd.returndef.GetTypeName); |           Message1(sym_e_no_enumerator_current,pd.returndef.GetTypeName); | ||||||
|         end |         end | ||||||
|         else |         else | ||||||
| @ -607,6 +611,8 @@ begin | |||||||
|       else |       else | ||||||
|         begin |         begin | ||||||
|           result:=cerrornode.create; |           result:=cerrornode.create; | ||||||
|  |           hloopvar.free; | ||||||
|  |           hloopbody.free; | ||||||
|           Message1(sym_e_no_enumerator,expr.resultdef.GetTypeName); |           Message1(sym_e_no_enumerator,expr.resultdef.GetTypeName); | ||||||
|         end; |         end; | ||||||
|       end; |       end; | ||||||
|  | |||||||
| @ -4334,6 +4334,7 @@ implementation | |||||||
|                   pd := tprocdef(Tprocsym(sym).ProcdefList[i]); |                   pd := tprocdef(Tprocsym(sym).ProcdefList[i]); | ||||||
|                   if (pd.proctypeoption = potype_function) and |                   if (pd.proctypeoption = potype_function) and | ||||||
|                      is_boolean(pd.returndef) and |                      is_boolean(pd.returndef) and | ||||||
|  |                      (pd.minparacount = 0) and | ||||||
|                      (pd.visibility >= vis_public) then |                      (pd.visibility >= vis_public) then | ||||||
|                   begin |                   begin | ||||||
|                     result:=pd; |                     result:=pd; | ||||||
|  | |||||||
							
								
								
									
										27
									
								
								tests/test/tforin22.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tests/test/tforin22.pp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | |||||||
|  | { %FAIL} | ||||||
|  | {$mode objfpc} | ||||||
|  | {$apptype console} | ||||||
|  | 
 | ||||||
|  | type  | ||||||
|  |   T = class | ||||||
|  |     F: Integer; | ||||||
|  |     function MoveNext(a: Integer): Boolean; | ||||||
|  |     property Current: Integer read F; | ||||||
|  |   end; | ||||||
|  | 
 | ||||||
|  | function T.MoveNext(a: Integer): Boolean;  | ||||||
|  | begin  | ||||||
|  |   Result := true;  | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | operator enumerator(a: Integer): T; | ||||||
|  | begin | ||||||
|  |   Result := T.Create; | ||||||
|  |   Result.F := a; | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | var | ||||||
|  |   i: Integer; | ||||||
|  | begin | ||||||
|  |   for i in 1 do Writeln(i); | ||||||
|  | end. | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 paul
						paul