Package: PTypeAssistantTC

PTypeAssistantTC

nameinstructionbranchcomplexitylinemethod
PTypeAssistantTC(ITypeCheckerAssistantFactory)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
checkConstraint(PType, PType, ILexLocation)
M: 0 C: 21
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
checkReturnType(PType, PType, boolean, ILexLocation)
M: 0 C: 47
100%
M: 0 C: 12
100%
M: 0 C: 7
100%
M: 0 C: 9
100%
M: 0 C: 1
100%
deBracket(Object)
M: 5 C: 5
50%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
deBracket(PType)
M: 5 C: 5
50%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
equals(LinkedList, LinkedList)
M: 4 C: 27
87%
M: 2 C: 4
67%
M: 2 C: 2
50%
M: 2 C: 4
67%
M: 0 C: 1
100%
equals(PType, Object)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getClassType(PType, Environment, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getComposeTypes(PType)
M: 5 C: 7
58%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getFunction(PType)
M: 3 C: 7
70%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getMap(PType, String)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getOperation(PType, String)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getProduct(PType, String)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getProduct(PType, int, String)
M: 3 C: 10
77%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getRecord(PType, String)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getSeq(PType, String)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getSet(PType, String)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
getUnion(PType, String)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
hasSupertype(AClassType, PType)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hasVoid(PType)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isClass(PType, Environment, String)
M: 3 C: 10
77%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isFunction(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isMap(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isOperation(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isOrdered(PType, ILexLocation)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isProduct(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isProduct(PType, int, String)
M: 3 C: 11
79%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isRecord(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isSeq(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isSet(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isTag(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isType(PType, Class)
M: 3 C: 12
80%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isType(PType, String)
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
isUnion(PType, String)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
isUnknown(AUnionType)
M: 0 C: 22
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
isUnknown(PType)
M: 0 C: 15
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
isVoid(PType)
M: 3 C: 8
73%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
narrowerThan(PType, AAccessSpecifierAccessSpecifier)
M: 3 C: 9
75%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
narrowerThanBaseCase(PType, AAccessSpecifierAccessSpecifier)
M: 4 C: 31
89%
M: 3 C: 5
63%
M: 3 C: 2
40%
M: 1 C: 7
88%
M: 0 C: 1
100%
polymorph(PType, ILexNameToken, PType)
M: 3 C: 12
80%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
possibleConstraint(PType, PType, ILexLocation)
M: 0 C: 20
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
toDetailedString(PType)
M: 3 C: 7
70%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
toDisplay(PType)
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
typeResolve(PType, ATypeDefinition, IQuestionAnswer, TypeCheckInfo)
M: 3 C: 13
81%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 2 C: 1
33%
M: 0 C: 1
100%
unResolve(PType)
M: 1 C: 7
88%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 1 C: 3
75%
M: 0 C: 1
100%

Coverage

1: /*
2: * #%~
3: * The VDM Type Checker
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.typechecker.assistant.type;
23:
24: import java.util.LinkedList;
25:
26: import org.overture.ast.analysis.AnalysisException;
27: import org.overture.ast.analysis.intf.IQuestionAnswer;
28: import org.overture.ast.assistant.IAstAssistant;
29: import org.overture.ast.assistant.pattern.PTypeList;
30: import org.overture.ast.assistant.type.PTypeAssistant;
31: import org.overture.ast.definitions.ATypeDefinition;
32: import org.overture.ast.definitions.PDefinition;
33: import org.overture.ast.intf.lex.ILexLocation;
34: import org.overture.ast.intf.lex.ILexNameToken;
35: import org.overture.ast.types.AAccessSpecifierAccessSpecifier;
36: import org.overture.ast.types.ABracketType;
37: import org.overture.ast.types.AClassType;
38: import org.overture.ast.types.AFunctionType;
39: import org.overture.ast.types.AOperationType;
40: import org.overture.ast.types.AProductType;
41: import org.overture.ast.types.ARecordInvariantType;
42: import org.overture.ast.types.SSetType;
43: import org.overture.ast.types.AUnionType;
44: import org.overture.ast.types.AUnknownType;
45: import org.overture.ast.types.AVoidType;
46: import org.overture.ast.types.PType;
47: import org.overture.ast.types.SMapType;
48: import org.overture.ast.types.SSeqType;
49: import org.overture.typechecker.Environment;
50: import org.overture.typechecker.TypeCheckInfo;
51: import org.overture.typechecker.TypeChecker;
52: import org.overture.typechecker.assistant.ITypeCheckerAssistantFactory;
53: import org.overture.typechecker.utilities.type.ConcreateTypeImplementor;
54: import org.overture.typechecker.utilities.type.PTypeResolver;
55:
56: public class PTypeAssistantTC extends PTypeAssistant implements IAstAssistant
57: {
58:         protected ITypeCheckerAssistantFactory af;
59:
60:         public PTypeAssistantTC(ITypeCheckerAssistantFactory af)
61:         {
62:                 super(af);
63:                 this.af = af;
64:         }
65:
66:         public boolean hasSupertype(AClassType cto, PType other)
67:         {
68:                 return af.createPDefinitionAssistant().hasSupertype(cto.getClassdef(), other);
69:         }
70:
71:         public boolean isType(PType type, Class<? extends PType> typeclass)
72:         {
73:                 try
74:                 {
75:                         return type.apply(af.getPTypeExtendedChecker(type.getLocation().getModule()), typeclass);
76:                 } catch (AnalysisException e)
77:                 {
78:                         return false;
79:                 }
80:
81:         }
82:
83:         public PType polymorph(PType type, ILexNameToken pname, PType actualType)
84:         {
85:                 try
86:                 {
87:                         return type.apply(af.getConcreateTypeImplementor(), new ConcreateTypeImplementor.Newquestion(pname, actualType));
88:
89:                 } catch (AnalysisException e)
90:                 {
91:                         return null;
92:                 }
93:
94:         }
95:
96:         public boolean isUnknown(PType type)
97:         {
98:•                if (type instanceof AUnionType)
99:                 {
100:                         return isUnknown((AUnionType) type);
101:•                } else if (type instanceof AUnknownType)
102:                 {
103:                         return true;
104:                 }
105:                 return false;
106:         }
107:
108:         public boolean isUnion(PType type, String fromModule)
109:         {
110:                 try
111:                 {
112:                         return type.apply(af.getUnionBasisChecker(), fromModule);
113:                 }
114:                 catch (AnalysisException e)
115:                 {
116:                         return false;
117:                 }
118:         }
119:
120:         public AUnionType getUnion(PType type, String fromModule)
121:         {
122:                 try
123:                 {
124:                         return type.apply(af.getUnionTypeFinder(), fromModule);
125:                 }
126:                 catch (AnalysisException e)
127:                 {
128:                         return null;
129:                 }
130:         }
131:
132:         public boolean isFunction(PType type, String fromModule)
133:         {
134:                 try
135:                 {
136:                         return type.apply(af.getPTypeFunctionChecker(fromModule));
137:                 }
138:                 catch (AnalysisException e)
139:                 {
140:                         return false;
141:                 }
142:         }
143:
144:         public AFunctionType getFunction(PType type)
145:         {
146:                 try
147:                 {
148:                         return type.apply(af.getFunctionTypeFinder());
149:                 } catch (AnalysisException e)
150:                 {
151:                         return null;
152:                 }
153:         }
154:
155:         public PType typeResolve(PType type, ATypeDefinition root,
156:                         IQuestionAnswer<TypeCheckInfo, PType> rootVisitor,
157:                         TypeCheckInfo question)
158:         {
159:                 try
160:                 {
161:                         return type.apply(af.getPTypeResolver(), new PTypeResolver.Newquestion(root, rootVisitor, question));
162:                 } catch (AnalysisException e)
163:                 {
164:                         return null;
165:                 }
166:         }
167:
168:         public void unResolve(PType type)
169:         {
170:                 try
171:                 {
172:                         type.apply(af.getTypeUnresolver());
173:                 } catch (AnalysisException e)
174:                 {
175:
176:                 }
177:         }
178:
179:         public boolean isOperation(PType type, String fromModule)
180:         {
181:                 try
182:                 {
183:                         return type.apply(af.getOperationBasisChecker(), fromModule);
184:                 }
185:                 catch (AnalysisException e)
186:                 {
187:                         return false;
188:                 }
189:         }
190:
191:         public AOperationType getOperation(PType type, String fromModule)
192:         {
193:                 try
194:                 {
195:                         return type.apply(af.getOperationTypeFinder(), fromModule);
196:                 }
197:                 catch (AnalysisException e)
198:                 {
199:                         return null;
200:                 }
201:
202:         }
203:
204:         public boolean isSeq(PType type, String fromModule)
205:         {
206:                 try
207:                 {
208:                         return type.apply(af.getSeqBasisChecker(), fromModule);
209:                 }
210:                 catch (AnalysisException e)
211:                 {
212:                         return false;
213:                 }
214:         }
215:
216:         public SSeqType getSeq(PType type, String fromModule)
217:         {
218:                 try
219:                 {
220:                         return type.apply(af.getSeqTypeFinder(), fromModule);
221:                 }
222:                 catch (AnalysisException e)
223:                 {
224:                         return null;
225:                 }
226:         }
227:
228:         public boolean isMap(PType type, String fromModule)
229:         {
230:                 try
231:                 {
232:                         return type.apply(af.getMapBasisChecker(), fromModule);
233:                 }
234:                 catch (AnalysisException e)
235:                 {
236:                         return false;
237:                 }
238:         }
239:
240:         public SMapType getMap(PType type, String fromModule)
241:         {
242:                 try
243:                 {
244:                         return type.apply(af.getMapTypeFinder(), fromModule);
245:                 }
246:                 catch (AnalysisException e)
247:                 {
248:                         return null;
249:                 }
250:         }
251:
252:         public boolean isSet(PType type, String fromModule)
253:         {
254:                 try
255:                 {
256:                         return type.apply(af.getSetBasisChecker(), fromModule);
257:                 }
258:                 catch (AnalysisException e)
259:                 {
260:                         return false;
261:                 }
262:         }
263:
264:         public SSetType getSet(PType type, String fromModule)
265:         {
266:                 try
267:                 {
268:                         return type.apply(af.getSetTypeFinder(), fromModule);
269:                 }
270:                 catch (AnalysisException e)
271:                 {
272:                         return null;
273:                 }
274:         }
275:
276:         public boolean isRecord(PType type, String fromModule)
277:         {
278:                 try
279:                 {
280:                         return type.apply(af.getRecordBasisChecker(), fromModule);
281:                 }
282:                 catch (AnalysisException e)
283:                 {
284:                         return false;
285:                 }
286:         }
287:
288:         public boolean isTag(PType type, String fromModule)
289:         {
290:                 try
291:                 {
292:                         return type.apply(af.getTagBasisChecker(), fromModule);
293:                 }
294:                 catch (AnalysisException e)
295:                 {
296:                         return false;
297:                 }
298:         }
299:
300:         public ARecordInvariantType getRecord(PType type, String fromModule)
301:         {
302:                 try
303:                 {
304:                         return type.apply(af.getRecordTypeFinder(), fromModule);
305:                 }
306:                 catch (AnalysisException e)
307:                 {
308:                         return null;
309:                 }
310:         }
311:
312:         public boolean isClass(PType type, Environment env, String fromModule)
313:         {
314:                 try
315:                 {
316:                         return type.apply(af.getClassBasisChecker(env), fromModule);
317:                 }
318:                 catch (AnalysisException e)
319:                 {
320:                         return false;
321:                 }
322:         }
323:
324:         public AClassType getClassType(PType type, Environment env, String fromModule)
325:         {
326:                 try
327:                 {
328:                         return type.apply(af.getClassTypeFinder(env), fromModule);
329:                 }
330:                 catch (AnalysisException e)
331:                 {
332:                         return null;
333:                 }
334:         }
335:
336:         public AProductType getProduct(PType type, String fromModule)
337:         {
338:                 try
339:                 {
340:                         return type.apply(af.getProductTypeFinder(), fromModule);
341:                 }
342:                 catch (AnalysisException e)
343:                 {
344:                         return null;
345:                 }
346:
347:         }
348:
349:         public boolean isProduct(PType type, String fromModule)
350:         {
351:                 try
352:                 {
353:                         return type.apply(af.getProductBasisChecker(), fromModule);
354:                 }
355:                 catch (AnalysisException e)
356:                 {
357:                         return false;
358:                 }
359:         }
360:
361:         public boolean narrowerThan(PType type,
362:                         AAccessSpecifierAccessSpecifier accessSpecifier)
363:         {
364:                 try
365:                 {
366:                         return type.apply(af.getNarrowerThanComparator(), accessSpecifier);
367:                 } catch (AnalysisException e)
368:                 {
369:                         return false;
370:                 }
371:         }
372:
373:         public boolean narrowerThanBaseCase(PType type,
374:                         AAccessSpecifierAccessSpecifier accessSpecifier)
375:         {
376:•                if (type.getDefinitions() != null)
377:                 {
378:                         boolean result = false;
379:•                        for (PDefinition d : type.getDefinitions())
380:                         {
381:•                                result = result
382:•                                                || af.createPAccessSpecifierAssistant().narrowerThan(d.getAccess(), accessSpecifier);
383:                         }
384:                         return result;
385:                 } else
386:                 {
387:                         return false;
388:                 }
389:         }
390:
391:         public boolean equals(PType type, Object other)
392:         {
393:                 try
394:                 {
395:                         return type.apply(af.getTypeEqualityChecker(), other);
396:                 } catch (AnalysisException e)
397:                 {
398:                         return false;
399:                 }
400:
401:         }
402:
403:         public PType deBracket(PType other)
404:         {
405:
406:•                while (other instanceof ABracketType)
407:                 {
408:                         other = ((ABracketType) other).getType();
409:                 }
410:
411:                 return other;
412:         }
413:
414:         // public static Object deBracket(Object other) // used at pog-string-base, problematic conversion.
415:         // {
416:         // while (other instanceof ABracketType)
417:         // {
418:         // other = ((ABracketType) other).getType();
419:         // }
420:         //
421:         // return other;
422:         // }
423:
424:         public PType isType(PType type, String typename)
425:         {
426:                 try
427:                 {
428:                         return type.apply(af.getPTypeFinder(type.getLocation().getModule()), typename);
429:                 }
430:                 catch (AnalysisException e)
431:                 {
432:                         return null;
433:                 }
434:         }
435:
436:         public String toDisplay(PType type)
437:         {
438:                 try
439:                 {
440:                         return type.apply(af.getTypeDisplayer());
441:                 } catch (AnalysisException e)
442:                 {
443:                         return null;
444:                 }
445:         }
446:
447:         public String toDetailedString(PType type)
448:         {
449:                 try
450:                 {
451:                         return type.apply(af.getDetailedTypeDisplayer());
452:                 } catch (AnalysisException e)
453:                 {
454:                         return null;
455:                 }
456:         }
457:
458:         public boolean isProduct(PType type, int size, String fromModule)
459:         {
460:                 try
461:                 {
462:                         return type.apply(af.getProductExtendedChecker(fromModule), size);
463:                 }
464:                 catch (AnalysisException e)
465:                 {
466:                         return false;
467:                 }
468:         }
469:
470:         public AProductType getProduct(PType type, int size, String fromModule)
471:         {
472:                 try
473:                 {
474:                         return type.apply(af.getProductExtendedTypeFinder(fromModule), size);
475:                 }
476:                 catch (AnalysisException e)
477:                 {
478:                         return null;
479:                 }
480:         }
481:
482:         public boolean equals(LinkedList<PType> parameters, LinkedList<PType> other)
483:         {
484:
485:•                if (parameters.size() != other.size())
486:                 {
487:                         return false;
488:                 }
489:
490:•                for (int i = 0; i < parameters.size(); i++)
491:                 {
492:•                        if (!af.createPTypeAssistant().equals(parameters.get(i), other.get(i)))
493:                         {
494:                                 return false;
495:                         }
496:                 }
497:
498:                 return true;
499:         }
500:
501:         public boolean isVoid(PType type)
502:         {
503:                 try
504:                 {
505:                         return type.apply(af.getVoidBasisChecker());
506:                 } catch (AnalysisException e)
507:                 {
508:                         return false;
509:                 }
510:         }
511:
512:         public boolean hasVoid(PType type)
513:         {
514:                 try
515:                 {
516:                         return type.apply(af.getVoidExistanceChecker());
517:                 } catch (AnalysisException e)
518:                 {
519:                         return false;
520:                 }
521:         }
522:
523:         public Object deBracket(Object other)
524:         {
525:•                while (other instanceof ABracketType)
526:                 {
527:                         other = ((ABracketType) other).getType();
528:                 }
529:
530:                 return other;
531:         }
532:
533:         public PTypeList getComposeTypes(PType type)
534:         {
535:                 try
536:                 {
537:                         return type.apply(af.getComposeTypeCollector());
538:                 } catch (AnalysisException e)
539:                 {
540:                         return new PTypeList();
541:                 }
542:         }
543:
544:         public PType checkConstraint(PType constraint, PType actual,
545:                         ILexLocation location)
546:         {
547:•                if (constraint != null)
548:                 {
549:•                        if (!af.getTypeComparator().isSubType(actual, constraint, true))
550:                         {
551:                                 TypeChecker.report(3327, "Value is not of the right type", location);
552:                                 TypeChecker.detail2("Actual", actual, "Expected", constraint);
553:                         }
554:                 }
555:
556:                 return actual;
557:         }
558:
559:         public PType possibleConstraint(PType constraint, PType actual,
560:                         ILexLocation location)
561:         {
562:•                if (constraint != null)
563:                 {
564:•                        if (!af.getTypeComparator().compatible(constraint, actual))
565:                         {
566:                                 TypeChecker.report(3327, "Value is not of the right type", location);
567:                                 TypeChecker.detail2("Actual", actual, "Expected", constraint);
568:                         }
569:                 }
570:
571:                 return actual;
572:         }
573:
574:         public PType checkReturnType(PType constraint, PType actual, boolean mandatory, ILexLocation location)
575:         {
576:                 PTypeAssistantTC assistant = af.createPTypeAssistant();
577:
578:•                if (constraint != null && mandatory        && !assistant.isUnknown(actual))
579:                 {
580:•                        if (assistant.hasVoid(actual) && !(constraint instanceof AVoidType))
581:                         {
582:                                 TypeChecker.report(3328, "Statement may return void value", location);
583:                                 TypeChecker.detail2("Actual", actual, "Expected", constraint);
584:                         }
585:•                        else if (!af.getTypeComparator().compatible(constraint, actual))
586:                         {
587:                                 TypeChecker.report(3327, "Value is not of the right type", location);
588:                                 TypeChecker.detail2("Actual", actual, "Expected", constraint);
589:                         }
590:                 }
591:
592:                 return actual;
593:         }
594:
595:         public boolean isUnknown(AUnionType type)
596:         {
597:•                for (PType t : type.getTypes())
598:                 {
599:•                        if (af.createPTypeAssistant().isUnknown(t))
600:                         {
601:                                 return true;
602:                         }
603:                 }
604:
605:                 return false;
606:         }
607:
608:         public boolean isOrdered(PType type, ILexLocation from)
609:         {
610:                 try
611:                 {
612:                         return type.apply(af.getIsOrderedVisitor(),from);
613:                 } catch (AnalysisException e)
614:                 {
615:                         return false;
616:                 }
617:         }
618: }