Convert values to strings when assigning to a string variable

Currently, a string variable can easily be reassigned to
a different type. Make it so that the value it's being
reassigned to is converted to a string first.

Bug: 224601891
Test: go test
Change-Id: I82252cf9e106b5a3677458cf1df2e9d1dfefe0f6
diff --git a/mk2rbc/mk2rbc_test.go b/mk2rbc/mk2rbc_test.go
index 4084660..08926e5 100644
--- a/mk2rbc/mk2rbc_test.go
+++ b/mk2rbc/mk2rbc_test.go
@@ -1265,7 +1265,7 @@
 TEST_VAR_LIST += bar
 TEST_VAR_2 := $(if $(TEST_VAR),bar)
 TEST_VAR_3 := $(if $(TEST_VAR),bar,baz)
-TEST_VAR_3 := $(if $(TEST_VAR),$(TEST_VAR_LIST))
+TEST_VAR_4 := $(if $(TEST_VAR),$(TEST_VAR_LIST))
 `,
 		expected: `load("//build/make/core:product_config.rbc", "rblf")
 
@@ -1276,7 +1276,7 @@
   g["TEST_VAR_LIST"] += ["bar"]
   g["TEST_VAR_2"] = ("bar" if g["TEST_VAR"] else "")
   g["TEST_VAR_3"] = ("bar" if g["TEST_VAR"] else "baz")
-  g["TEST_VAR_3"] = (g["TEST_VAR_LIST"] if g["TEST_VAR"] else [])
+  g["TEST_VAR_4"] = (g["TEST_VAR_LIST"] if g["TEST_VAR"] else [])
 `,
 	},
 	{
@@ -1419,6 +1419,7 @@
 # Duplicated variable
 #RBC# type_hint list MY_VAR_2
 #RBC# type_hint list my-local-var-with-dashes
+#RBC# type_hint string MY_STRING_VAR
 
 MY_VAR := foo
 MY_VAR_UNHINTED := foo
@@ -1431,6 +1432,8 @@
 MY_VAR_4 := foo
 
 my-local-var-with-dashes := foo
+
+MY_STRING_VAR := $(wildcard foo/bar.mk)
 `,
 		expected: `# Test type hints
 # Unsupported type
@@ -1448,9 +1451,10 @@
   # Vars set after other statements still get the hint
   g["MY_VAR_2"] = ["foo"]
   # You can't specify a type hint after the first statement
-  rblf.mk2rbc_error("product.mk:19", "type_hint annotations must come before the first Makefile statement")
+  rblf.mk2rbc_error("product.mk:20", "type_hint annotations must come before the first Makefile statement")
   g["MY_VAR_4"] = "foo"
   _my_local_var_with_dashes = ["foo"]
+  g["MY_STRING_VAR"] = " ".join(rblf.expand_wildcard("foo/bar.mk"))
 `,
 	},
 }