A BinaryWriter will write types to a binary output stream. The types should be read back from the stream using BinaryReader .
BinaryWriter
BinaryReader
NOTE: Under-the-hood, this class is essentially a wrapper for BinaryAutomataWriter.
BinaryAutomataWriter
3965396639673968396939703971397239733974397539763977
} } public Nominal.EffectiveTuple expandAsEffectiveTuple(Nominal lhs) throws IOException, ResolveError { Type raw = lhs.raw(); if (raw instanceof Type.EffectiveTuple) { Type nominal = expandOneLevel(lhs.nominal()); if (!(nominal instanceof Type.EffectiveTuple)) { nominal = raw; // discard nominal information } return (Nominal.EffectiveTuple) Nominal.construct(nominal, raw); } else {
39803981398239833984398539863987398839893990
} public Nominal.Reference expandAsReference(Nominal lhs) throws IOException, ResolveError { Type.Reference raw = Type.effectiveReference(lhs.raw()); if (raw != null) { Type nominal = expandOneLevel(lhs.nominal()); if (!(nominal instanceof Type.Reference)) { nominal = raw; // discard nominal information } return (Nominal.Reference) Nominal.construct(nominal, raw); } else {
39943995399639973998399940004001400240034004
public Nominal.FunctionOrMethod expandAsFunctionOrMethod(Nominal lhs) throws IOException, ResolveError { Type.FunctionOrMethod raw = Type.effectiveFunctionOrMethod(lhs.raw()); if (raw != null) { Type nominal = expandOneLevel(lhs.nominal()); if (!(nominal instanceof Type.FunctionOrMethod)) { nominal = raw; // discard nominal information } return (Nominal.FunctionOrMethod) Nominal.construct(nominal, raw); } else {
40114012401340144015401640174018401940204021
Type.Nominal nt = (Type.Nominal) type; NameID nid = nt.name(); Path.ID mid = nid.module(); WhileyFile wf = builder.getSourceFile(mid); Type r = null; if (wf != null) { WhileyFile.Declaration decl = wf.declaration(nid.name()); if (decl instanceof WhileyFile.Type) { WhileyFile.Type td = (WhileyFile.Type) decl;
253025312532253325342535253625372538
@Test public void test_2498() { checkNotSubtype("[int]|int","any"); } @Test public void test_2499() { checkNotSubtype("[int]|int","[null]|null"); } @Test public void test_2500() { checkIsSubtype("[int]|int","[int]|int"); } private void checkIsSubtype(String from, String to) { Type ft = Type.fromString(from); Type tt = Type.fromString(to); assertTrue(Type.isSubtype(ft,tt)); }
253525362537253825392540254125422543
Type ft = Type.fromString(from); Type tt = Type.fromString(to); assertTrue(Type.isSubtype(ft,tt)); } private void checkNotSubtype(String from, String to) { Type ft = Type.fromString(from); Type tt = Type.fromString(to); assertFalse(Type.isSubtype(ft,tt)); }
580658075808580958105811581258135814
@Test public void test_5774() { checkNotSubtype("{int f2}|int","{null f2}|null"); } @Test public void test_5775() { checkNotSubtype("{int f2}|int","{int f1}|int"); } @Test public void test_5776() { checkIsSubtype("{int f2}|int","{int f2}|int"); } private void checkIsSubtype(String from, String to) { Type ft = Type.fromString(from); Type tt = Type.fromString(to); assertTrue(Type.isSubtype(ft,tt)); }
581158125813581458155816581758185819
5455565758596061626364
public Type parse() { return parse(new HashSet<String>()); } public Type parse(HashSet<String> typeVariables) { Type term = parseFunctionTerm(typeVariables); skipWhiteSpace(); while (index < str.length() && (str.charAt(index) == '|')) { // union type match("|");
6768697071727374757677
} return term; } public Type parseFunctionTerm(HashSet<String> typeVariables) { Type t = parseNotTerm(typeVariables); if(index >= str.length()) { return t; } char lookahead = str.charAt(index); if(lookahead == '(') { // this is a tuple, not a bracketed type. match("(");