Skip to content

Commit

Permalink
rename error
Browse files Browse the repository at this point in the history
  • Loading branch information
dsainati1 committed Nov 5, 2021
1 parent a86f1ab commit d14cb20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions runtime/interpreter/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,11 @@ func (e NonStorableStaticTypeError) Error() string {

// InterfaceMissingLocation is reported during interface lookup,
// if an interface is looked up without a location
type InterfaceMissingLocation struct {
type InterfaceMissingLocationError struct {
QualifiedIdentifier string
}

func (e *InterfaceMissingLocation) Error() string {
func (e *InterfaceMissingLocationError) Error() string {
return fmt.Sprintf(
"tried to look up interface %s without a location",
e.QualifiedIdentifier,
Expand Down
7 changes: 4 additions & 3 deletions runtime/interpreter/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2621,9 +2621,6 @@ func lookupInterface(interpreter *Interpreter, typeID string) (*sema.InterfaceTy
if err != nil {
return nil, err
}
if location == nil {
return nil, &InterfaceMissingLocation{QualifiedIdentifier: qualifiedIdentifier}
}

typ, err := interpreter.getInterfaceType(location, qualifiedIdentifier)
if err != nil {
Expand Down Expand Up @@ -3846,6 +3843,10 @@ func (interpreter *Interpreter) getNativeCompositeType(qualifiedIdentifier strin
}

func (interpreter *Interpreter) getInterfaceType(location common.Location, qualifiedIdentifier string) (*sema.InterfaceType, error) {
if location == nil {
return nil, &InterfaceMissingLocationError{QualifiedIdentifier: qualifiedIdentifier}
}

typeID := location.TypeID(qualifiedIdentifier)

elaboration := interpreter.getElaboration(location)
Expand Down

0 comments on commit d14cb20

Please sign in to comment.