Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Unified Diff: compiler/java/com/google/dart/compiler/type/InferredType.java

Issue 10459012: Issue 3223. Don't warn about types compatibility is one of the types was inferred (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/type/InferredType.java
diff --git a/compiler/java/com/google/dart/compiler/type/InferredType.java b/compiler/java/com/google/dart/compiler/type/InferredType.java
new file mode 100644
index 0000000000000000000000000000000000000000..e5ea3516fe59db9f9880692cab6c71368008b95a
--- /dev/null
+++ b/compiler/java/com/google/dart/compiler/type/InferredType.java
@@ -0,0 +1,34 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+package com.google.dart.compiler.type;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * Marker interface for {@link Type} which means that this {@link Type} was not specified by user,
+ * but instead inferred from context.
+ */
+public interface InferredType {
+ public static class Helper {
+ /**
+ * @return the mix of the given {@link Type} interface and {@link InferredType}.
+ */
+ public static Type make(final Type type) {
+ if (type instanceof InterfaceType) {
+ return (Type) Proxy.newProxyInstance(type.getClass().getClassLoader(), new Class<?>[] {
Brian Wilkerson 2012/05/29 20:25:46 Long term, I'm fairly certain that we don't want t
+ InterfaceType.class,
+ InferredType.class}, new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ return method.invoke(type, args);
+ }
+ });
+ }
+ return type;
+ }
+ }
+}
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698