Get symbols of included files in standalone scripts

Fix #597.
Add diagnostics for type checking errors

The calls to file systems are deferred until the main ones fail.
Remove an unused variable
Merge pull request #599 from dungpa/script-files

Get symbols of included files in standalone scripts