File tree Expand file tree Collapse file tree 5 files changed +52
-5
lines changed Expand file tree Collapse file tree 5 files changed +52
-5
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,13 @@ type List struct {
77}
88
99func (l List ) Is (t Type ) bool {
10- _ , ok := t .(List )
10+ v , ok := t .(List )
11+ if ! ok {
12+ return false
13+ }
14+ if v .ElementType != nil {
15+ return l .ElementType .Is (v .ElementType )
16+ }
1117 return ok
1218}
1319
Original file line number Diff line number Diff line change @@ -7,7 +7,13 @@ type Map struct {
77}
88
99func (m Map ) Is (t Type ) bool {
10- _ , ok := t .(Map )
10+ v , ok := t .(Map )
11+ if ! ok {
12+ return false
13+ }
14+ if v .AttributeType != nil {
15+ return m .AttributeType .Is (v .AttributeType )
16+ }
1117 return ok
1218}
1319
Original file line number Diff line number Diff line change @@ -7,7 +7,23 @@ type Object struct {
77}
88
99func (o Object ) Is (t Type ) bool {
10- _ , ok := t .(Object )
10+ v , ok := t .(Object )
11+ if ! ok {
12+ return false
13+ }
14+ if v .AttributeTypes != nil {
15+ if len (o .AttributeTypes ) != len (v .AttributeTypes ) {
16+ return false
17+ }
18+ for k , typ := range o .AttributeTypes {
19+ if _ , ok := v .AttributeTypes [k ]; ! ok {
20+ return false
21+ }
22+ if ! typ .Is (v .AttributeTypes [k ]) {
23+ return false
24+ }
25+ }
26+ }
1127 return ok
1228}
1329
Original file line number Diff line number Diff line change @@ -7,7 +7,13 @@ type Set struct {
77}
88
99func (s Set ) Is (t Type ) bool {
10- _ , ok := t .(Set )
10+ v , ok := t .(Set )
11+ if ! ok {
12+ return false
13+ }
14+ if v .ElementType != nil {
15+ return s .ElementType .Is (v .ElementType )
16+ }
1117 return ok
1218}
1319
Original file line number Diff line number Diff line change @@ -7,7 +7,20 @@ type Tuple struct {
77}
88
99func (tu Tuple ) Is (t Type ) bool {
10- _ , ok := t .(Tuple )
10+ v , ok := t .(Tuple )
11+ if ! ok {
12+ return false
13+ }
14+ if v .ElementTypes != nil {
15+ if len (v .ElementTypes ) != len (tu .ElementTypes ) {
16+ return false
17+ }
18+ for pos , typ := range tu .ElementTypes {
19+ if ! typ .Is (v .ElementTypes [pos ]) {
20+ return false
21+ }
22+ }
23+ }
1124 return ok
1225}
1326
You can’t perform that action at this time.
0 commit comments