nsresolver fails on TraitUse without adaptations
This commit is contained in:
		
							parent
							
								
									bfc346ebab
								
							
						
					
					
						commit
						a98301f940
					
				| @ -156,6 +156,7 @@ func (nsr *NamespaceResolver) EnterNode(w walker.Walkable) bool { | |||||||
| 			nsr.ResolveName(t, "") | 			nsr.ResolveName(t, "") | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		if n.TraitAdaptationList != nil { | ||||||
| 			for _, a := range n.TraitAdaptationList.Adaptations { | 			for _, a := range n.TraitAdaptationList.Adaptations { | ||||||
| 				switch aa := a.(type) { | 				switch aa := a.(type) { | ||||||
| 				case *stmt.TraitUsePrecedence: | 				case *stmt.TraitUsePrecedence: | ||||||
| @ -174,7 +175,7 @@ func (nsr *NamespaceResolver) EnterNode(w walker.Walkable) bool { | |||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 
 | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return true | 	return true | ||||||
|  | |||||||
| @ -348,6 +348,7 @@ func TestResolveGroupUse(t *testing.T) { | |||||||
| func TestResolveTraitUse(t *testing.T) { | func TestResolveTraitUse(t *testing.T) { | ||||||
| 	nameAB := &name.Name{Parts: []node.Node{&name.NamePart{Value: "A"}, &name.NamePart{Value: "B"}}} | 	nameAB := &name.Name{Parts: []node.Node{&name.NamePart{Value: "A"}, &name.NamePart{Value: "B"}}} | ||||||
| 	nameB := &name.Name{Parts: []node.Node{&name.NamePart{Value: "B"}}} | 	nameB := &name.Name{Parts: []node.Node{&name.NamePart{Value: "B"}}} | ||||||
|  | 	nameD := &name.Name{Parts: []node.Node{&name.NamePart{Value: "D"}}} | ||||||
| 
 | 
 | ||||||
| 	fullyQualifiedNameB := &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "B"}}} | 	fullyQualifiedNameB := &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "B"}}} | ||||||
| 	fullyQualifiedNameBC := &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "B"}, &name.NamePart{Value: "C"}}} | 	fullyQualifiedNameBC := &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "B"}, &name.NamePart{Value: "C"}}} | ||||||
| @ -387,11 +388,17 @@ func TestResolveTraitUse(t *testing.T) { | |||||||
| 					}, | 					}, | ||||||
| 				}, | 				}, | ||||||
| 			}, | 			}, | ||||||
|  | 			&stmt.TraitUse{ | ||||||
|  | 				Traits: []node.Node{ | ||||||
|  | 					nameD, | ||||||
|  | 				}, | ||||||
|  | 			}, | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	expected := map[node.Node]string{ | 	expected := map[node.Node]string{ | ||||||
| 		nameB:                "A\\B", | 		nameB:                "A\\B", | ||||||
|  | 		nameD:                "D", | ||||||
| 		relativeNameB:        "B", | 		relativeNameB:        "B", | ||||||
| 		fullyQualifiedNameB:  "B", | 		fullyQualifiedNameB:  "B", | ||||||
| 		fullyQualifiedNameBC: "B\\C", | 		fullyQualifiedNameBC: "B\\C", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user