diff --git a/dsymbol/src/dsymbol/conversion/first.d b/dsymbol/src/dsymbol/conversion/first.d index 1064811..78b3189 100644 --- a/dsymbol/src/dsymbol/conversion/first.d +++ b/dsymbol/src/dsymbol/conversion/first.d @@ -266,7 +266,16 @@ final class FirstPass : ASTVisitor if (targ.type.type2 is null) continue; auto part = targ.type.type2.typeIdentifierPart; - if (part is null) continue; + if (part is null) + { + if (targ.type.type2.builtinType == tok!"") continue; + auto builtInName = getBuiltinTypeName(targ.type.type2.builtinType); + auto newArg = GCAllocator.instance.make!(VariableContext.TypeInstance)(); + newArg.parent = current; + newArg.chain ~= builtInName; + current.args ~= newArg; + continue; + } auto newArg = GCAllocator.instance.make!(VariableContext.TypeInstance)(); newArg.parent = current; diff --git a/dsymbol/src/dsymbol/conversion/second.d b/dsymbol/src/dsymbol/conversion/second.d index eb7de5b..73fa012 100644 --- a/dsymbol/src/dsymbol/conversion/second.d +++ b/dsymbol/src/dsymbol/conversion/second.d @@ -177,18 +177,29 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC auto key = part.name; DSymbol* first; + bool isBuiltin; foreach(i, crumb; ti.args[count].chain) { auto argName = crumb; if (i == 0) { - if (m) if (key in m) { argName = m[key].name; } + // check if that's a built in type + // if it is, then use it and skip the type creation step + foreach(builtin; builtinSymbols) + { + if (builtin.name == crumb) + { + first = builtin; + isBuiltin = true; + break; + } + } auto result = moduleScope.getSymbolsAtGlobalScope(istring(argName)); if (result.length == 0) { @@ -205,7 +216,7 @@ DSymbol* createTypeWithTemplateArgs(DSymbol* type, TypeLookup* lookup, VariableC auto ca = ti.args[count]; if (ca.chain.length > 0) - mapping[key] = createTypeWithTemplateArgs(first, lookup, ca, cache, moduleScope, depth, null); + mapping[key] = isBuiltin ? first : createTypeWithTemplateArgs(first, lookup, ca, cache, moduleScope, depth, null); } } } diff --git a/tests/tc_templates_resolve/expected_3_1.txt b/tests/tc_templates_resolve/expected_3_1.txt new file mode 100644 index 0000000..6a19b1a --- /dev/null +++ b/tests/tc_templates_resolve/expected_3_1.txt @@ -0,0 +1,9 @@ +identifiers +alignof k +init k +mangleof k +sizeof k +stringof k +tupleof k +value_key v int value_key stdin 0 +value_value v int value_value stdin 0 diff --git a/tests/tc_templates_resolve/file3.d b/tests/tc_templates_resolve/file3.d new file mode 100644 index 0000000..4f2a26a --- /dev/null +++ b/tests/tc_templates_resolve/file3.d @@ -0,0 +1,11 @@ +struct HashMap(Key, Value) +{ + Key value_key; + Value value_value; +} + +void main() +{ + auto hmap = HashMap!(int, int)(); + hmap. +} \ No newline at end of file diff --git a/tests/tc_templates_resolve/run.sh b/tests/tc_templates_resolve/run.sh index 8bd9670..8810ffa 100755 --- a/tests/tc_templates_resolve/run.sh +++ b/tests/tc_templates_resolve/run.sh @@ -5,9 +5,6 @@ set -u MODE=$1 - -# ../../bin/dcd-client $1 file1.d --extended -c 270 - function check () { echo "$1 $2" ../../bin/dcd-client $MODE $1.d --extended -c $2 > $3.txt @@ -36,8 +33,13 @@ diff actual_2_1.txt expected_2_1.txt --strip-trailing-cr diff actual_2_2.txt expected_2_2.txt --strip-trailing-cr +#echo "test5" +../../bin/dcd-client $1 file3.d --extended -c 144 > actual_3_1.txt +diff actual_3_1.txt expected_3_1.txt --strip-trailing-cr -#echo "test c omplex" + + +#echo "test complex" check complex 1121 actual_complex_1 expected_complex_1 check complex 1162 actual_complex_2 expected_complex_2 check complex 1205 actual_complex_3 expected_complex_3 @@ -46,4 +48,4 @@ check complex 1271 actual_complex_5 expected_complex_5 check complex 1296 actual_complex_6 expected_complex_6 check complex 1321 actual_complex_7 expected_complex_7 check complex 1345 actual_complex_8 expected_complex_8 - +check complex 1413 actual_complex_9 expected_complex_9