File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/types/checker/__tests__ Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11import { check } from '..'
22import { parse } from '../../ast'
3- import { CyclicInheritanceError } from '../../errors'
3+ import { CannotFindSymbolError , CyclicInheritanceError } from '../../errors'
44import { Type } from '../../types/type'
55
66const testcases : {
@@ -134,6 +134,23 @@ const testcases: {
134134 }
135135 ` ,
136136 result : { type : null , errors : [ ] }
137+ } ,
138+ {
139+ input : `
140+ class AccessControl {
141+ private void privateMethod() { System.out.println("Private method."); }
142+ public void attemptAccess() { privateMethod(); }
143+ }
144+
145+ public class Main {
146+ public static void main(String[] args) {
147+ AccessControl obj = new AccessControl();
148+ obj.attemptAccess();
149+ obj.privateMethod(); // Should be flagged as an error
150+ }
151+ }
152+ ` ,
153+ result : { type : null , errors : [ new CannotFindSymbolError ( ) ] }
137154 }
138155]
139156
You can’t perform that action at this time.
0 commit comments