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

Unified Diff: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java

Issue 10703046: Issue 3753. Support for @deprecated annotation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Analyze for @deprecated all invocable elements Created 8 years, 6 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
Index: compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
index 2369bfdff22fdd6423bfbdeff528682c69a0cf02..4dd715c30878698c4f9469dc93574d0006b2c359 100644
--- a/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
+++ b/compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java
@@ -2923,6 +2923,56 @@ public class TypeAnalyzerCompilerTest extends CompilerTestCase {
libraryResult.getErrors(),
errEx(TypeErrorCode.NOT_A_TYPE, 3, 1, 4));
}
+
+ public void test_metadata_deprecated_1() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "// @deprecated",
+ "ttt() {}",
+ "class A {",
+ " // @deprecated",
+ " var fff;",
+ " // @deprecated",
+ " mmmm() {}",
+ " // @deprecated",
+ " operator + (other) {}",
+ "}",
+ "main() {",
+ " ttt();",
+ " A a = new A();",
+ " a.fff = 0;",
+ " a.mmmm();",
+ " a + 0;",
+ "}",
+ "");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(TypeErrorCode.DEPRECATED_ELEMENT, 13, 3, 3),
+ errEx(TypeErrorCode.DEPRECATED_ELEMENT, 15, 5, 3),
+ errEx(TypeErrorCode.DEPRECATED_ELEMENT, 16, 5, 4),
+ errEx(TypeErrorCode.DEPRECATED_ELEMENT, 17, 5, 1));
+ }
+
+ public void test_metadata_deprecated_2() throws Exception {
+ AnalyzeLibraryResult libraryResult = analyzeLibrary(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "// @deprecated",
+ "class A {",
+ " A.named() {}",
+ " // @deprecated",
+ " A.depreca() {}",
+ "}",
+ "main() {",
+ " new A.named();",
+ " new A.depreca();",
+ "}",
+ "");
+ assertErrors(
+ libraryResult.getErrors(),
+ errEx(TypeErrorCode.DEPRECATED_ELEMENT, 9, 7, 1),
+ errEx(TypeErrorCode.DEPRECATED_ELEMENT, 10, 7, 1),
+ errEx(TypeErrorCode.DEPRECATED_ELEMENT, 10, 9, 7));
+ }
public void test_assignMethod() throws Exception {
AnalyzeLibraryResult libraryResult = analyzeLibrary(

Powered by Google App Engine
This is Rietveld 408576698