php8.1: added never type (#8)
This commit is contained in:
		
							parent
							
								
									8c35b0aef1
								
							
						
					
					
						commit
						8df80651e0
					
				| @ -226,3 +226,31 @@ class Foo { | |||||||
| 
 | 
 | ||||||
| 	suite.Run() | 	suite.Run() | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func TestNeverType(t *testing.T) { | ||||||
|  | 	suite := tester.NewParserDumpTestSuite(t) | ||||||
|  | 	suite.UsePHP8() | ||||||
|  | 	suite.Code = `<?php | ||||||
|  | function f(): never {} | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 	suite.Expected = `&ast.Root{ | ||||||
|  | 	Stmts: []ast.Vertex{ | ||||||
|  | 		&ast.StmtFunction{ | ||||||
|  | 			Name: &ast.Identifier{ | ||||||
|  | 				Val: []byte("f"), | ||||||
|  | 			}, | ||||||
|  | 			ReturnType: &ast.Name{ | ||||||
|  | 				Parts: []ast.Vertex{ | ||||||
|  | 					&ast.NamePart{ | ||||||
|  | 						Val: []byte("never"), | ||||||
|  | 					}, | ||||||
|  | 				}, | ||||||
|  | 			}, | ||||||
|  | 			Stmts: []ast.Vertex{}, | ||||||
|  | 		}, | ||||||
|  | 	}, | ||||||
|  | },` | ||||||
|  | 
 | ||||||
|  | 	suite.Run() | ||||||
|  | } | ||||||
|  | |||||||
| @ -23,3 +23,9 @@ class Foo { | |||||||
| } | } | ||||||
| `) | `) | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | func TestNeverTypePHP81(t *testing.T) { | ||||||
|  | 	tester.NewParserPrintTestSuite(t).UsePHP8().Run(`<?php | ||||||
|  | function f(): never {} | ||||||
|  | `) | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user