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

Side by Side Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 1215053003: Compute mixin application constructors in the ClassElement.constructors getter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library engine.compile_time_error_code_test; 5 library engine.compile_time_error_code_test;
6 6
7 import 'package:analyzer/src/generated/engine.dart'; 7 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 9 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
10 import 'package:analyzer/src/generated/source_io.dart'; 10 import 'package:analyzer/src/generated/source_io.dart';
(...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT 1905 CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
1906 ]); 1906 ]);
1907 verify([source]); 1907 verify([source]);
1908 } 1908 }
1909 1909
1910 void test_extendsDisallowedClass_classTypeAlias_bool() { 1910 void test_extendsDisallowedClass_classTypeAlias_bool() {
1911 Source source = addSource(r''' 1911 Source source = addSource(r'''
1912 class M {} 1912 class M {}
1913 class C = bool with M;'''); 1913 class C = bool with M;''');
1914 computeLibrarySourceErrors(source); 1914 computeLibrarySourceErrors(source);
1915 assertErrors(source, [ 1915 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
1916 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
1917 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS
1918 ]);
1919 verify([source]); 1916 verify([source]);
1920 } 1917 }
1921 1918
1922 void test_extendsDisallowedClass_classTypeAlias_double() { 1919 void test_extendsDisallowedClass_classTypeAlias_double() {
1923 Source source = addSource(r''' 1920 Source source = addSource(r'''
1924 class M {} 1921 class M {}
1925 class C = double with M;'''); 1922 class C = double with M;''');
1926 computeLibrarySourceErrors(source); 1923 computeLibrarySourceErrors(source);
1927 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); 1924 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
1928 verify([source]); 1925 verify([source]);
1929 } 1926 }
1930 1927
1931 void test_extendsDisallowedClass_classTypeAlias_int() { 1928 void test_extendsDisallowedClass_classTypeAlias_int() {
1932 Source source = addSource(r''' 1929 Source source = addSource(r'''
1933 class M {} 1930 class M {}
1934 class C = int with M;'''); 1931 class C = int with M;''');
1935 computeLibrarySourceErrors(source); 1932 computeLibrarySourceErrors(source);
1936 assertErrors(source, [ 1933 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
1937 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
1938 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS
1939 ]);
1940 verify([source]); 1934 verify([source]);
1941 } 1935 }
1942 1936
1943 void test_extendsDisallowedClass_classTypeAlias_Null() { 1937 void test_extendsDisallowedClass_classTypeAlias_Null() {
1944 Source source = addSource(r''' 1938 Source source = addSource(r'''
1945 class M {} 1939 class M {}
1946 class C = Null with M;'''); 1940 class C = Null with M;''');
1947 computeLibrarySourceErrors(source); 1941 computeLibrarySourceErrors(source);
1948 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); 1942 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
1949 verify([source]); 1943 verify([source]);
1950 } 1944 }
1951 1945
1952 void test_extendsDisallowedClass_classTypeAlias_num() { 1946 void test_extendsDisallowedClass_classTypeAlias_num() {
1953 Source source = addSource(r''' 1947 Source source = addSource(r'''
1954 class M {} 1948 class M {}
1955 class C = num with M;'''); 1949 class C = num with M;''');
1956 computeLibrarySourceErrors(source); 1950 computeLibrarySourceErrors(source);
1957 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]); 1951 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
1958 verify([source]); 1952 verify([source]);
1959 } 1953 }
1960 1954
1961 void test_extendsDisallowedClass_classTypeAlias_String() { 1955 void test_extendsDisallowedClass_classTypeAlias_String() {
1962 Source source = addSource(r''' 1956 Source source = addSource(r'''
1963 class M {} 1957 class M {}
1964 class C = String with M;'''); 1958 class C = String with M;''');
1965 computeLibrarySourceErrors(source); 1959 computeLibrarySourceErrors(source);
1966 assertErrors(source, [ 1960 assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
1967 CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
1968 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS
1969 ]);
1970 verify([source]); 1961 verify([source]);
1971 } 1962 }
1972 1963
1973 void test_extendsEnum() { 1964 void test_extendsEnum() {
1974 Source source = addSource(r''' 1965 Source source = addSource(r'''
1975 enum E { ONE } 1966 enum E { ONE }
1976 class A extends E {}'''); 1967 class A extends E {}''');
1977 computeLibrarySourceErrors(source); 1968 computeLibrarySourceErrors(source);
1978 assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]); 1969 assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]);
1979 verify([source]); 1970 verify([source]);
(...skipping 3295 matching lines...) Expand 10 before | Expand all | Expand 10 after
5275 class M1 = Object with M2; 5266 class M1 = Object with M2;
5276 class M2 = Object with M1;'''); 5267 class M2 = Object with M1;''');
5277 computeLibrarySourceErrors(source); 5268 computeLibrarySourceErrors(source);
5278 assertErrors(source, [ 5269 assertErrors(source, [
5279 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 5270 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
5280 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE 5271 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
5281 ]); 5272 ]);
5282 verify([source]); 5273 verify([source]);
5283 } 5274 }
5284 5275
5276 void test_recursiveInterfaceInheritance_mixin_superclass() {
5277 // Make sure we don't get CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS in
5278 // addition--that would just be confusing.
5279 Source source = addSource('''
5280 class C = D with M;
5281 class D = C with M;
5282 class M {}
5283 ''');
5284 computeLibrarySourceErrors(source);
5285 assertErrors(source, [
5286 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
5287 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
5288 ]);
5289 verify([source]);
5290 }
5291
5285 void test_recursiveInterfaceInheritance_tail() { 5292 void test_recursiveInterfaceInheritance_tail() {
5286 Source source = addSource(r''' 5293 Source source = addSource(r'''
5287 abstract class A implements A {} 5294 abstract class A implements A {}
5288 class B implements A {}'''); 5295 class B implements A {}''');
5289 computeLibrarySourceErrors(source); 5296 computeLibrarySourceErrors(source);
5290 assertErrors(source, [ 5297 assertErrors(source, [
5291 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS 5298 CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
5292 ]); 5299 ]);
5293 verify([source]); 5300 verify([source]);
5294 } 5301 }
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
6136 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6143 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6137 verify([source]); 6144 verify([source]);
6138 reset(); 6145 reset();
6139 } 6146 }
6140 6147
6141 void _check_wrongNumberOfParametersForOperator1(String name) { 6148 void _check_wrongNumberOfParametersForOperator1(String name) {
6142 _check_wrongNumberOfParametersForOperator(name, ""); 6149 _check_wrongNumberOfParametersForOperator(name, "");
6143 _check_wrongNumberOfParametersForOperator(name, "a, b"); 6150 _check_wrongNumberOfParametersForOperator(name, "a, b");
6144 } 6151 }
6145 } 6152 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698