Skip to content

Commit

Permalink
Fix breakage in cmd/scip
Browse files Browse the repository at this point in the history
  • Loading branch information
varungandhi-src committed Jun 11, 2024
1 parent c89a34f commit b1c2986
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions cmd/scip/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type occurrenceKey struct {
}

func scipOccurrenceKey(occ *scip.Occurrence) occurrenceKey {
return occurrenceKey{*scip.NewRange(occ.Range), occ.SymbolRoles}
return occurrenceKey{scip.NewRange(occ.Range), occ.SymbolRoles}
}

type occurrenceMap = map[occurrenceKey]*scip.Occurrence
Expand Down Expand Up @@ -202,16 +202,16 @@ func (st *symbolTable) addRelationship(sym string, path string, rel *scip.Relati

func (st *symbolTable) addOccurrence(path string, occ *scip.Occurrence) error {
if occ.Symbol == "" {
return emptyStringError{what: "symbol", context: fmt.Sprintf("occurrence at %s @ %s", path, scipRangeToString(*scip.NewRange(occ.Range)))}
return emptyStringError{what: "symbol", context: fmt.Sprintf("occurrence at %s @ %s", path, scipRangeToString(scip.NewRange(occ.Range)))}
}
if scip.SymbolRole_Definition.Matches(occ) && scip.SymbolRole_ForwardDefinition.Matches(occ) {
return forwardDefIsDefinitionError{occ.Symbol, path, *scip.NewRange(occ.Range)}
return forwardDefIsDefinitionError{occ.Symbol, path, scip.NewRange(occ.Range)}
}
tryInsertOccurrence := func(occMap fileOccurrenceMap) error {
occKey := scipOccurrenceKey(occ)
if fileOccs, ok := occMap[path]; ok {
if _, ok := fileOccs[occKey]; ok {
return duplicateOccurrenceWarning{occ.Symbol, path, *scip.NewRange(occ.Range), occ.SymbolRoles}
return duplicateOccurrenceWarning{occ.Symbol, path, scip.NewRange(occ.Range), occ.SymbolRoles}
} else {
fileOccs[occKey] = occ
}
Expand All @@ -231,7 +231,7 @@ func (st *symbolTable) addOccurrence(path string, occ *scip.Occurrence) error {
return err
}
} else {
return missingSymbolForOccurrenceError{occ.Symbol, path, *scip.NewRange(occ.Range)}
return missingSymbolForOccurrenceError{occ.Symbol, path, scip.NewRange(occ.Range)}
}
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/scip/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ func TestErrors(t *testing.T) {
"missingSymbolForOccurrence",
makeIndex(nil, nil, stringMap{"f": {"a"}}),
[]error{
missingSymbolForOccurrenceError{"a", "f", *scip.NewRange(placeholderRange)},
missingSymbolForOccurrenceError{"a", "f", scip.NewRange(placeholderRange)},
},
},
{
"duplicateOccurrence",
makeIndex([]string{"a"}, stringMap{"f": {"b"}}, stringMap{"f": {"a", "a", "b", "b"}}),
[]error{
duplicateOccurrenceWarning{"a", "f", *scip.NewRange(placeholderRange), placeholderRole},
duplicateOccurrenceWarning{"b", "f", *scip.NewRange(placeholderRange), placeholderRole},
duplicateOccurrenceWarning{"a", "f", scip.NewRange(placeholderRange), placeholderRole},
duplicateOccurrenceWarning{"b", "f", scip.NewRange(placeholderRange), placeholderRole},
},
},
}
Expand Down

0 comments on commit b1c2986

Please sign in to comment.