Permalink
Browse files

just stashing whatever it is here

  • Loading branch information...
elucash committed Oct 22, 2018
1 parent c4a0dff commit 47ed50ddaf8e7cd1ae58ae91a705f1fd400ccb49
Showing with 1,381 additions and 199 deletions.
  1. +1 −0 .buckconfig
  2. +28 −28 .classpath
  3. +282 −0 old/io/immutables/lang/node/Impl.java
  4. +167 −0 old/io/immutables/lang/node/Matcher.java
  5. +1 −1 {src/io/immutables/lang/type → old/io/immutables/lang/node}/Name.java
  6. +150 −0 old/io/immutables/lang/node/Node.java
  7. +7 −0 old/io/immutables/lang/node/NodeProducer.java
  8. +66 −0 old/io/immutables/lang/node/Scope.java
  9. +90 −0 old/io/immutables/lang/node/TestMatcher.java
  10. +213 −0 old/io/immutables/lang/node/TestTypecheck.java
  11. +128 −0 old/io/immutables/lang/node/Type.java
  12. +7 −0 old/io/immutables/lang/node/__BUCK
  13. +1 −1 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/BUCK
  14. +2 −1 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/Constraint22.java
  15. +3 −2 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/DefinedImpl.java
  16. +28 −0 old/io/immutables/lang/type22/Name.java
  17. +1 −1 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/Substitute.java
  18. +1 −1 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/TestSubstitute.java
  19. +2 −1 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/Type22.java
  20. +1 −1 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/TypeMatcher.java
  21. +1 −1 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/fixture/BUCK
  22. +2 −2 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/fixture/Node33.java
  23. +3 −3 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/fixture/Scope.java
  24. +35 −44 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/fixture/TestTypecheck.java
  25. +6 −6 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/fixture/TypeMatcher.java
  26. +5 −5 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/fixture/Typecheck.java
  27. 0 {src/io/immutables/lang/type → old/io/immutables/lang/type22}/notes.txt
  28. +2 −2 {src/io/immutables/lang/typing → old/io/immutables/lang/typing2}/BUCK
  29. +3 −3 {src/io/immutables/lang/typing → old/io/immutables/lang/typing2}/Checking.java
  30. +1 −1 {src/io/immutables/lang/typing → old/io/immutables/lang/typing2}/Constraint.java
  31. +2 −2 {src/io/immutables/lang/typing → old/io/immutables/lang/typing2}/Impl.java
  32. +1 −1 {src/io/immutables/lang/typing → old/io/immutables/lang/typing2}/Node.java
  33. +5 −5 {src/io/immutables/lang/typing → old/io/immutables/lang/typing2}/TestChecking.java
  34. +1 −1 {src/io/immutables/lang/typing → old/io/immutables/lang/typing2}/Type.java
  35. +26 −0 src/io/immutables/grammar/Productions.java
  36. +0 −1 src/io/immutables/lang/BUCK
  37. +5 −2 src/io/immutables/lang/Syntax.grammar
  38. +2 −75 src/io/immutables/lang/fixture/debug.im
  39. +76 −0 src/io/immutables/lang/fixture/debug.old.im
  40. +17 −0 src/io/immutables/lang/fixture/expressions.test.im
  41. +1 −0 src/io/immutables/lang/processor/BUCK
  42. +1 −1 type-experiment/irrr/Defs.java
  43. +1 −1 type-experiment/irrr/EmptyParameters.java
  44. +1 −1 type-experiment/irrr/ImportedPackage.java
  45. +1 −1 type-experiment/irrr/Imports.java
  46. +1 −1 type-experiment/irrr/Resolver.java
  47. +1 −1 type-experiment/irrr/TestParameters.java
  48. +1 −1 type-experiment/irrr/TypeDeclaration.java
  49. +1 −1 type-experiment/irrr/VariableSubstitution.java
@@ -2,6 +2,7 @@
[project]
ignore = \
target \
.classes, \
.git, \
.settings, \
@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path=".gen/src">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
<classpathentry kind="src" path="src"/>
<classpathentry excluding="io/immutables/lang/node/" kind="src" path="old"/>
<classpathentry kind="src" path=".gen/src">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="buck-out/annotation/src/io/immutables/grammar/fixture/__fixture_gen__">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
<classpathentry kind="src" path="buck-out/annotation/src/io/immutables/grammar/fixture/__fixture_gen__">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="buck-out/annotation/src/io/immutables/lang/__lang_gen__">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
<classpathentry kind="src" path="buck-out/annotation/src/io/immutables/lang/__lang_gen__">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="buck-out/annotation/src/io/immutables/lang/fixture/__fixture_gen__">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
<classpathentry kind="src" path="buck-out/annotation/src/io/immutables/lang/fixture/__fixture_gen__">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="buck-out/gen/lib/guava_jar/guava-22.0.jar" sourcepath="buck-out/gen/lib/guava_src/guava-22.0-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/jsr305_jar/jsr305-3.0.1.jar" sourcepath="buck-out/gen/lib/jsr305_src/jsr305-3.0.1-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/junit_jar/junit-4.12.jar" sourcepath="buck-out/gen/lib/junit_src/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/hamcrest_jar/hamcrest-core-1.3.jar" sourcepath="buck-out/gen/lib/hamcrest_src/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_trees_jar/trees-2.5.6.jar" sourcepath="buck-out/gen/lib/immutables_trees_src/trees-2.5.6-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_ordinal_jar/ordinal-2.5.6.jar" sourcepath="buck-out/gen/lib/immutables_ordinal_src/ordinal-2.5.6-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_annotations_jar/value-2.5.6-annotations.jar" sourcepath="buck-out/gen/lib/immutables_annotations_src/value-2.5.6-annotations-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_generator_jar/generator-processor-2.5.6-luggage.jar" sourcepath="buck-out/gen/lib/immutables_generator_src/generator-processor-2.5.6-luggage-sources.jar"/>
<classpathentry kind="output" path=".classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="buck-out/gen/lib/guava_jar/guava-22.0.jar" sourcepath="buck-out/gen/lib/guava_src/guava-22.0-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/jsr305_jar/jsr305-3.0.1.jar" sourcepath="buck-out/gen/lib/jsr305_src/jsr305-3.0.1-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/junit_jar/junit-4.12.jar" sourcepath="buck-out/gen/lib/junit_src/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/hamcrest_jar/hamcrest-core-1.3.jar" sourcepath="buck-out/gen/lib/hamcrest_src/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_trees_jar/trees-2.5.6.jar" sourcepath="buck-out/gen/lib/immutables_trees_src/trees-2.5.6-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_ordinal_jar/ordinal-2.5.6.jar" sourcepath="buck-out/gen/lib/immutables_ordinal_src/ordinal-2.5.6-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_annotations_jar/value-2.5.6-annotations.jar" sourcepath="buck-out/gen/lib/immutables_annotations_src/value-2.5.6-annotations-sources.jar"/>
<classpathentry kind="lib" path="buck-out/gen/lib/immutables_generator_jar/generator-processor-2.5.6-luggage.jar" sourcepath="buck-out/gen/lib/immutables_generator_src/generator-processor-2.5.6-luggage-sources.jar"/>
<classpathentry kind="output" path=".classes"/>
</classpath>
@@ -0,0 +1,282 @@
package io.immutables.lang.node;
import com.google.common.base.Joiner;
import io.immutables.collect.Vect;
import io.immutables.lang.node.Type.Feature;
final class Impl {
private Impl() {}
static Type.Feature[] noFeatures() {
return NO_FEATURES;
}
static Type.Parameter[] noParameters() {
return NO_PARAMETERS;
}
static Type[] noTypes() {
return NO_PARAMETERS; // subtype empty array is oks
}
static Type.Feature getFeature(Vect<Type.Feature> features, Name name) {
for (Type.Feature f : features) {
if (f.name().equals(name)) {
return f;
}
}
return missing(name);
}
static final Type Undefined = new Type() {
@Override
public <I, O> O accept(Visitor<I, O> v, I in) {
return v.undefined(in);
}
@Override
public String toString() {
return "???";
}
};
static final Type.Product Empty = product();
static Type.Product product(Type... components) {
assert components.length != 1 : "single component product is equivalent to the component itself";
return new Type.Product() {
@Override
public Type[] components() {
return components;
}
@Override
public <I, O> O accept(Type.Visitor<I, O> v, I in) {
return this == Empty
? v.empty(in)
: v.product(this, in);
}
@Override
public String toString() {
return "(" + Joiner.on(", ").join(components) + ")";
}
};
}
static Type.Unresolved unresolved(Name name) {
return new Type.Unresolved() {
@Override
public Name name() {
return name;
}
@Override
public <I, O> O accept(Type.Visitor<I, O> v, I in) {
return v.unresolved(this, in);
}
@Override
public String toString() {
return "!/" + name + "/!";
}
};
}
static Type.Feature feature(Name name, Type in, Type out) {
return new Type.Feature() {
@Override
public Name name() {
return name;
}
@Override
public Type in() {
return in;
}
@Override
public Type out() {
return out;
}
@Override
public String toString() {
return "" + name + (in == Empty ? "" : in instanceof Type.Product ? in : ("(" + in + ")")) + out;
}
@Override
public Type.Parameter[] parameters() {
return NO_PARAMETERS;
}
};
}
static Type.Feature missing(Name name) {
return new Type.Feature() {
@Override
public Name name() {
return name;
}
@Override
public Type out() {
return Undefined;
}
@Override
public Type in() {
return Undefined;
}
@Override
public Type.Parameter[] parameters() {
return NO_PARAMETERS;
}
@Override
public String toString() {
return name + "/??";
}
};
}
static Type.Variable allocate(Name name) {
return new Type.Variable() {
@Override
public Name name() {
return name;
}
@Override
public <I, O> O accept(Type.Visitor<I, O> v, I in) {
return v.variable(this, in);
}
@Override
public String toString() {
return "<" + name + ">";
}
};
}
// @Immutable
// public static abstract class DefinedImpl implements Type.Declared {
// private final int hashCode = System.identityHashCode(this);
//
// @Override
// public abstract Vect<Feature> features();
//
// @Override
// public boolean equals(Object obj) {
// return this == obj;
// }
//
// @Override
// public String toString() {
// return name() + (!arguments().isEmpty() ? "<" + Joiner.on(", ").join(arguments()) + ">" : "");
// }
//
// @Override
// public int hashCode() {
// return hashCode;
// }
//
// public static final class Builder extends ImmutableDefinedImpl.Builder {}
// }
static Type.Declared declared(Name name, Type... arguments) {
return declared(name, arguments, Undefined, Vect.of());
}
static Type.Declared declared(Name name, Vect<Feature> features, Type... arguments) {
return declared(name, arguments, Undefined, features);
}
static Type.Declared simple(Name name, Vect<Feature> features) {
return new Type.Declared() {
@Override
public Name name() {
return name;
}
@Override
public Vect<Feature> features() {
return features;
}
@Override
public <I, O> O accept(Type.Visitor<I, O> v, I in) {
return v.declared(this, in);
}
@Override
public String toString() {
return name.toString();
}
};
}
static Type.Declared withArguments(Name name, Vect<Feature> features, Type... arguments) {
assert arguments.length > 0;
return new DeclaredImplementation(arguments, name, features);
}
private static final class DeclaredImplementation implements Type.Declared {
private final Type[] arguments;
private final Name name;
private final Vect<Feature> features;
private DeclaredImplementation(Type[] arguments, Name name, Vect<Feature> features) {
this.arguments = arguments;
this.name = name;
this.features = features;
}
@Override
public Name name() {
return name;
}
@Override
public Vect<Feature> features() {
return features;
}
@Override
public <I, O> O accept(Type.Visitor<I, O> v, I in) {
return v.declared(this, in);
}
@Override
public String toString() {
return name + "<" + Joiner.on(", ").join(arguments) + ">";
}
@Override
public boolean equals(Object obj) {
return obj instanceof eq();
}
}
static Type.Parameter declare(int index, Name name) {
return new Type.Parameter() {
@Override
public Name name() {
return name;
}
@Override
public int index() {
return index;
}
@Override
public <I, O> O accept(Type.Visitor<I, O> v, I in) {
return v.parameter(this, in);
}
@Override
public String toString() {
return "<" + index + ":" + name + ">";
}
};
}
private static final Type.Feature[] NO_FEATURES = new Type.Feature[0];
private static final Type.Parameter[] NO_PARAMETERS = new Type.Parameter[0];
}
Oops, something went wrong.

0 comments on commit 47ed50d

Please sign in to comment.