fix Issue 13403 - [ICE][2.067Alpha] Internal error: backend\type.c 332 with new package protection extension.
[Refactoring] TemplateInstance::semantic()

- Remove a goto jump
- Reduce code indent level
- Use ModToStc in TemplateThisParameter resolution
[Refactoring] Add Module::rootImports() and use it in TemplateInstance::needsCodegen()

it would make compilation a little faster so `rootImports` cache the result.
[Refactoring] Remove the hack code introduced in #1760

AST identity issue has been properly fixed in #3383 (fceb16bbf7).
use checkedint to check overflow
fix Issue 13417 - segmentation fault when deduce template type
Merge pull request #3945 from 9rnsr/refactor_template

[Refactoring] template.c
fix Issue 13424 - Initialization of delegate to do-nothing default causes segfault at runtime
Merge pull request #3950 from 9rnsr/fix13417

[REG2.066] Issue 13417 - segmentation fault when deduce template type
Merge pull request #3951 from 9rnsr/fix13424

[REG2.066] Issue 13424 - Initialization of delegate to do-nothing default causes segfault at runtime
Move error-related stuff into its own file and merge with color
Remove un-convertable comment
Do not use octal literals in dmd
Do not rely on implicit conversion of int to bool
Do not rely on implicit narrowing integral conversions
Merge pull request #3955 from yebblies/comment4

[DDMD] Remove un-convertable comment
Merge pull request #3954 from yebblies/impconv

[DDMD] Do not rely on implicit narrowing integral conversions
Merge pull request #3953 from yebblies/impbool

[DDMD] Do not rely on implicit conversion of int to bool
Merge pull request #3931 from yebblies/errors

[refactor] Move error-related stuff into its own file and merge with color
Add TemplateInstance::tnext to construct instantiation dependency graph

To detect speculative instantiations in codegen phase, `tnext` is neccesary for the `test6()` case `runnable/link13350.d`. That's a big difference from the PR #2550.