Package wyil.lang

Examples of wyil.lang.Type$UnionOfRecords


    }
  }

  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 {
View Full Code Here


  }

  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 {
View Full Code Here

  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 {
View Full Code Here

      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;
View Full Code Here

  @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));
  }
View Full Code Here

    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));
  }
View Full Code Here

  @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));
  }
View Full Code Here

    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));
  }
View Full Code Here

  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("|");
View Full Code Here

    }
    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("(");
View Full Code Here

TOP

Related Classes of wyil.lang.Type$UnionOfRecords

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.