Error when something inherits a non-existent type
This commit is contained in:
parent
d4146ac6ce
commit
150fc0dd4a
@ -197,8 +197,21 @@ func (analyzer analysisOperation) analyzeType (
|
|||||||
bitten,
|
bitten,
|
||||||
err = analyzer.fetchSectionFromIdentifier(inputType.Name())
|
err = analyzer.fetchSectionFromIdentifier(inputType.Name())
|
||||||
|
|
||||||
outputType.actual = actual.(*TypeSection)
|
if actual == nil {
|
||||||
// TODO: produce an error if this doesnt work
|
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 {
|
if bitten.Length() > 0 {
|
||||||
err = bitten.NewError(
|
err = bitten.NewError(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
:arf
|
:arf
|
||||||
|
require './something'
|
||||||
---
|
---
|
||||||
|
|
||||||
type ro aBasicInt:Int 5
|
type ro aBasicInt:Int 5
|
||||||
@ -8,3 +9,5 @@ type ro bOnBasicInt:aBasicInt
|
|||||||
type ro cBasicObject:Obj
|
type ro cBasicObject:Obj
|
||||||
ro that:Int
|
ro that:Int
|
||||||
ro this:Int
|
ro this:Int
|
||||||
|
|
||||||
|
type ro dInheritedFromOther:something.Thing
|
||||||
|
3
tests/analyzer/typeSection/something/main.arf
Normal file
3
tests/analyzer/typeSection/something/main.arf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
:arf
|
||||||
|
---
|
||||||
|
type ro Thing:Int
|
Reference in New Issue
Block a user