[flang] Preserve order of type parameters
authorTim Keith <tkeith@nvidia.com>
Fri, 7 Dec 2018 01:52:43 +0000 (17:52 -0800)
committerTim Keith <tkeith@nvidia.com>
Fri, 7 Dec 2018 01:52:43 +0000 (17:52 -0800)
commitee908da8533816810f8716d0de1c6d684f27e66d
tree441b847fd947a12e13c94e25323643462e82b300
parent89efce51d507afab9115f949217ce74fae8e97f9
[flang] Preserve order of type parameters

Type parameters were sorted by the order of the type-param-def-stmts.
But we need to preserve the order of the type-param-name-list.
The is the order of positional parameters in a derived-type-spec.

So add `paramNames` to `DerivedTypeDetails` to preserve the original
order. Using this allows us to write module files with both the
type-param-name-list and type-param-def-stmts in the original order.

Also fix a bug where a duplicate type-param-def caused a spurious
extra error. If `MakeTypeSymbol()` reports an error we should not
call `SetType()` because it will just report another error.

Original-commit: flang-compiler/f18@3ca55b63333db3d779fe263583e3cb9fe7f4b2b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/239
flang/lib/semantics/mod-file.cc
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/symbol.h
flang/test/semantics/modfile12.f90
flang/test/semantics/resolve33.f90