8000 Typing: update type checking section · compiler-experts/miniJava@2354e9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2354e9b

Browse files
committed
Typing: update type checking section
1 parent f6f10cb commit 2354e9b

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,33 @@ If you are a team member of the project, please review the [Guidelines for Contr
141141
- parent: a class reference type that refers to its class
142142
- [x] create a `Hashtbl` that maps from class
143143
- [x] The second phase is concerned with verifying that the inside of classes is correct (mainly the body of methods). She will also make sure of the correction of the higher level expression.
144-
- [x] create 3 verification method that verifies the following aspects of the program
144+
- [x] create 3 verification methods that verify the following aspects of the program
145145
- [x] `verify_methods` that checks the type of methods
146-
- [x] create a local definition environment type called `current_env` it contains 3 fields as follows
146+
- [x] create a local definition environment type called `current_env` that contains 3 fields as follows
147147
- returntype: the declared return type of the method
148148
- variables: a `Hashtbl` that maps from local variable name to local variable declared type
149149
- this_class: the id of the class
150150
- env_type: a string that identifies the type of the local definition environment, it could be `constructor`, `method` or `attribute`, in this case, the `env_type` is `method`
151-
- [x] write a verification method (`verify_declared_args`) that checks the declared type of variables in the method arguments
151+
- [x] write a verification method (`verify_declared_args`) that checks the declared type of variables in the method argument list
152152
- [x] check if there exists Duplicate Local Variable
153153
- [x] write a verification method (`verify_statement`) that checks the body of the method
154-
- [x] check declared variables
154+
- [x] check variable declaration statement
155155
- [x] check block of statement
156156
- [x] check expression
157157
- [x] check return statement when it's none, ex: `return;`
158158
- [x] check return statement when it's not none, ex: `return x;`
159159
- [x] check throw statement
160+
- it does check if exception type or a supertype of that exception type is mentioned in a throws clause in the declaration of the method, it should be checked in compiling
160161
- [x] check while statement
161-
- [x] check if statement when it doesn't have `else`
162-
- [x] check if statement when it has `else`
162+
- [x] check if without else statement
163+
- [x] check if with else statement
163164
- [x] check for statement
164165
- [x] check try statement
165166
- [x] `verify_constructors` that checks the type of constructors
167+
- same as verify_methods, except for the following minor difference
168+
- `returntype` in the local definition environment `current_env` is a reference to the class it belongs to
169+
- `env_type` in the local definition environment `current_env` is `constructor`
170+
- check return statement in `verify_statement` is slightly different since constructors can have `reuturn;` but not something like `return x;`
166171
- [x] `verify_attributes` that checks the type of attributes
167172

168173
##### Errors that can be found during Type-checking
@@ -212,7 +217,8 @@ If you are a team member of the project, please review the [Guidelines for Contr
212217

213218
- errors related to overloading
214219
- errors related to overriding
215-
220+
- errors related to generic types
221+
- errors related to `this` keyword
216222

217223
#### Execution
218224

@@ -257,4 +263,9 @@ SameFunctionConstructorsDefined : raised when constructors of class have the sam
257263

258264
### Problems of Type
259265

266+
- not support overriding
267+
- not support overloading
268+
- not support generic types
269+
- not support typing related to `this` keyword
270+
260271
### Problems of Execution

0 commit comments

Comments
 (0)
0