Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christoph Reichenbach
EDAP15-exercise-3
Commits
8ec98cef
Commit
8ec98cef
authored
Dec 04, 2020
by
Alexandru Dura
Browse files
Check that type members exist
parent
e696498a
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/teal2/frontend/SemanticCheck.jrag
View file @
8ec98cef
...
...
@@ -31,9 +31,12 @@ aspect SemanticCheck {
Type contributes new SemanticError(sourceLocation(), "Actual type parameters are disallowed for types other than array[T].")
when !isArray() && getNumActual() != 0 to Program.semanticErrors();
Type contributes new SemanticError(sourceLocation(), "
array[T] should must hav
e a single type parameter.")
Type contributes new SemanticError(sourceLocation(), "
Instances of array[T] tak
e a single type parameter.")
when isArray() && getNumActual() != 1 to Program.semanticErrors();
TypeDecl contributes new SemanticError(sourceLocation(), "User defined type cannot have formal type parameters.")
when !isArray() && getNumTypeFormal() != 0 to Program.semanticErrors();
MemberAccess contributes new SemanticError(sourceLocation(), "Access of unknown field, '" + getIdentifier() + "'. Consider using type annotations.")
when getExpr().type().memberLookup(getIdentifier()) == null to Program.semanticErrors();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment