Error when something inherits a non-existent type

This commit is contained in:
Sasha Koshka 2022-10-12 13:06:59 -04:00
parent d4146ac6ce
commit 150fc0dd4a
3 changed files with 21 additions and 2 deletions

View File

@ -197,8 +197,21 @@ func (analyzer analysisOperation) analyzeType (
bitten,
err = analyzer.fetchSectionFromIdentifier(inputType.Name())
outputType.actual = actual.(*TypeSection)
// TODO: produce an error if this doesnt work
if actual == nil {
err = inputType.NewError (
"this type does not exist",
infoerr.ErrorKindError)
return
}
var worked bool
outputType.actual, worked = actual.(*TypeSection)
if !worked {
err = inputType.NewError (
"this must refer to a type or an interface",
infoerr.ErrorKindError)
return
}
if bitten.Length() > 0 {
err = bitten.NewError(

View File

@ -1,4 +1,5 @@
:arf
require './something'
---
type ro aBasicInt:Int 5
@ -8,3 +9,5 @@ type ro bOnBasicInt:aBasicInt
type ro cBasicObject:Obj
ro that:Int
ro this:Int
type ro dInheritedFromOther:something.Thing

View File

@ -0,0 +1,3 @@
:arf
---
type ro Thing:Int